【发布时间】:2015-01-28 02:13:51
【问题描述】:
我正在使用 mingw 在 Windows 上运行 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?
【问题讨论】:
-
“note: ld: cannot find -lglfw3”: 我猜这意味着你需要方便的 libglfw3 目标文件或源代码。
-
你在运行什么命令?我认为正常的 Rust 编译不需要 GCC。
-
@Shepmaster 我正在运行货物构建
-
我认为这不仅仅是一个标准的“Hello World”,是吗? GLFW 是一个 OpenGL 库。您是否使用了一些额外的板条箱或类似的东西?您能否提供给我们minimal reproducible example(stackoverflow.com/help/mcve) 以便我们进行更多调查?
-
@Shepmaster mcve 是什么?我正在使用 gl-rs