如何在 Windows 中为 Rust 设置 GTK?

问题描述 投票:0回答:1

我尝试在 Linux Mint 上使用 GTK4 和 Rust,并且它有效。我想使用 Visual Studio Tools 在 Windows 上执行相同的操作,但它不允许我,我尝试使用 GNU 和 MSYS,但它也不起作用。然后我尝试从 Linux 编译 Windows,但也出现错误。 我按照指南安装了程序和依赖项,但总是出现错误,指出在 MINGW 中找不到某些 GTK 库。 真诚地,我不明白该怎么办,非常感谢任何可以提供帮助的信息,当然,谢谢!

sudo apt install gcc-mingw-w64-x84-64
export PKG_CONFIG_SYSROOT_DIR=/usr/bin/x86_64-w64-mingw32-gcc
cargo build --target x86_64-pc-windows-gnu

什么也没有发生,它给了我这些错误:

note: /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgtk-3: No such file or directory
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk-3: No such file or directory
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -latk-1.0: No such file or directory
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk-3: No such file or directory
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -lcairo: No such file or directory
…
linux windows rust gtk mingw
1个回答
0
投票

您链接的说明适用于 GTK4,但您发布的错误消息暗示您的代码正在尝试使用 GTK3。请分享您的 Cargo.toml 和显示问题的最小 main.rs。 – 杰姆布
非常感谢Jmb!

© www.soinside.com 2019 - 2024. All rights reserved.