windows - 使用 glfw-rs 时 gcc.exe 找不到 -lglfw3

标签 windows gcc rust

我正在 Windows 上使用 mingw 运行 Rust(可能是我的第一个错误,但我不会放弃)。我下载了 64 位的所有内容,当我构建项目时,我得到了

error: linking with `gcc` failed: exit code: 1
note: gcc '-Wl,--enable-long-section-names' '-fno-use-linker-plugin' '-Wl,--nxcompat' '-static-libgcc' '-m64' '-L' 'C:\R
ust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-o' 'C:\Users\jay\projects\hello_world\target\hello_world.exe' 'C:\Users\jay
\projects\hello_world\target\hello_world.o' '-Wl,--gc-sections' 'C:\Users\jay\projects\hello_world\target\deps\libglfw-5
007f9fddc425da6.rlib' 'C:\Users\jay\projects\hello_world\target\deps\libbitflags-57b03d5337bba57b.rlib' 'C:\Users\jay\pr
ojects\hello_world\target\deps\libsemver-693b3d5412b8e4b9.rlib' 'C:\Users\jay\projects\hello_world\target\deps\liblog-4e
79c2d7625e8c6f.rlib' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-4e7c5e5c.rlib' 'C:\Rust\bin\rustlib\x86_64-pc
-windows-gnu\lib\libcollections-4e7c5e5c.rlib' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\libunicode-4e7c5e5c.rlib'
'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-4e7c5e5c.rlib' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\lib
alloc-4e7c5e5c.rlib' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-4e7c5e5c.rlib' 'C:\Rust\bin\rustlib\x86_64-p
c-windows-gnu\lib\libcore-4e7c5e5c.rlib' '-L' 'C:\Users\jay\projects\hello_world\target' '-L' 'C:\Users\jay\projects\hel
lo_world\target\deps' '-L' 'C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib' '-L' 'C:\Users\jay\projects\hello_world\.rust
\bin\x86_64-pc-windows-gnu' '-L' 'C:\Users\jay\projects\hello_world\bin\x86_64-pc-windows-gnu' '-Wl,--whole-archive' '-W
l,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic' '-lglfw3' '-lopengl32' '-lgdi32' '-lws2_32' '-lcompiler-rt'
note: ld: cannot find -lglfw3

    error: aborting due to previous error
    Could not compile `hello_world`.

(尝试对其进行格式化但是..?)

我相信问题出在我的 gcc.exe 上,每当我运行它时,它都会说找不到输入文件。有 gcc.exe 我可以替换它吗?

最佳答案

尝试下载precompiled GLFW libraries 。我将 lib-mingw 目录中的文件复制到我的 Rust 项目中。在我的 32 位 Windows 虚拟机上,我将它们放在 hello-glfw\bin\i686-pc-windows-gnu 中,但看起来您想要 hello_world\bin\x86_64-pc- windows-gnu。这使我能够运行 example from the glfw-rs README .

关于windows - 使用 glfw-rs 时 gcc.exe 找不到 -lglfw3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28183497/

相关文章:

c# - 适用于 Windows 的 Microsoftless C# 开发系统

c++ - 在 DOS 窗口中的任意位置写入

java - 仅当使用 Sqlite 数据库选中复选框时,如何将数据添加到另一个表?- android studio

c# - 调用 Windows 资源管理器外壳扩展

visual-studio-2008 - Visual Studio 2008 调试 CygWin gcc 编译的程序

c++ - 从硬件异常处理程序中抛出 C++ 异常。为什么 -fnon-call-exceptions 的行为不如预期?

tcp - 你如何阅读 &mut [0; 的内容? 128]?

C - 显示文件中 c 可执行文件的所有行以进行调试

rust - 在以 x86_64-pc-windows-gnu 为目标时使用 Cygwin 在 Rust 应用程序中链接 NTDLL

arrays - 如何将可变数组划分为可变子数组