【问题标题】:Rust: link failed with exit code 1181Rust:链接失败,退出代码 1181
【发布时间】:2019-12-02 08:35:32
【问题描述】:

Getting started 的第一个示例在“cargo run”处显示错误

C:\Users\HiWin10\hello-rust>cargo run --verbose
   Compiling hello-rust v0.1.0 (C:\Users\HiWin10\hello-rust)
     Running `rustc --edition=2018 --crate-name hello_rust src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=888d1f7b91fb6e4a -C extra-filename=-888d1f7b91fb6e4a --out-dir C:\Users\HiWin10\hello-rust\target\debug\deps -C incremental=C:\Users\HiWin10\hello-rust\target\debug\incremental -L dependency=C:\Users\HiWin10\hello-rust\target\debug\deps`
error: linking with `link.exe` failed: exit code: 1181
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.1twe2j0sf4nhwv0v.rcgu.o" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.1vsfetqgdl2mm9ku.rcgu.o" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.2b2k1el9ge2t96a7.rcgu.o" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.2wy84pmiszi6o3fj.rcgu.o" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.51bmf9dki30948b3.rcgu.o" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.q67qbh00yussp5o.rcgu.o" "/OUT:C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.exe" "C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.11f4ns4fn9v6i7z4.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\HiWin10\\hello-rust\\target\\debug\\deps" "/LIBPATH:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-c418a1c7c96bdbae.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-740e55ec30ec9b42.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-4e3d4b2c73be2130.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-e03c95365300773b.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-9b63ec27f8df7123.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-cc811f306714ba24.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-dee84a63f4b90027.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-7d070a58cfb70fe0.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-10ec18f1dfe36e70.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-e0e69d50f48d4667.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-45eb0e961cc324b2.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: LINK : fatal error LNK1181:


error: aborting due to previous error

error: Could not compile `hello-rust`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name hello_rust src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=888d1f7b91fb6e4a -C extra-filename=-888d1f7b91fb6e4a --out-dir C:\Users\HiWin10\hello-rust\target\debug\deps -C incremental=C:\Users\HiWin10\hello-rust\target\debug\incremental -L dependency=C:\Users\HiWin10\hello-rust\target\debug\deps` (exit code: 1)

C:\Users\HiWin10\hello-rust>

在 Intellij IDEA 中使用 intellij-rust 显示类似错误

C:/Users/HiWin10/.cargo/bin/cargo.exe run --package hello-rust --bin hello-rust
   Compiling hello-rust v0.1.0 (C:\Users\HiWin10\IdeaProjects\hello-rust)
error: linking with `link.exe` failed: exit code: 1181
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.1twe2j0sf4nhwv0v.rcgu.o" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.1vsfetqgdl2mm9ku.rcgu.o" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.2b2k1el9ge2t96a7.rcgu.o" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.2wy84pmiszi6o3fj.rcgu.o" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.51bmf9dki30948b3.rcgu.o" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.q67qbh00yussp5o.rcgu.o" "/OUT:C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.exe" "C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps\\hello_rust-888d1f7b91fb6e4a.11f4ns4fn9v6i7z4.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\HiWin10\\IdeaProjects\\hello-rust\\target\\debug\\deps" "/LIBPATH:C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-c418a1c7c96bdbae.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-740e55ec30ec9b42.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-4e3d4b2c73be2130.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-e03c95365300773b.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-9b63ec27f8df7123.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-cc811f306714ba24.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-dee84a63f4b90027.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-7d070a58cfb70fe0.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-10ec18f1dfe36e70.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-e0e69d50f48d4667.rlib" "C:\\Users\\HiWin10\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-45eb0e961cc324b2.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: LINK : fatal error LNK1181: 


error: aborting due to previous error

error: Could not compile `hello-rust`.

To learn more, run the command again with --verbose.

Process finished with exit code 101

由于在 LNK1181 之后没有具体的库名称,我不知道缺少什么。您能帮忙建议如何诊断吗?

PS:Windows Subsystem for Linux 下的“cargo run”会显示一个可能不同的错误

testwsl@localdesktop:~/hello-rust$ cargo run
   Compiling hello-rust v0.1.0 (/home/testwsl/hello-rust)
error: linking with `cc` failed: exit code: 2
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.1vqvvt1zu5yjmkx2.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.35e6mijtpa61ekwc.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.3guttdxbl4ju2ho3.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.3w3apmysmbwmta20.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.555cq0ss6gtr2lhv.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.pnha9ks6selykbe.rcgu.o" "-o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.2jltqdnkmdrx6xjn.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/testwsl/hello-rust/target/debug/deps" "-L" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-9895e8982b0a79e7.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-57306b8ed3378a0e.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-54463ae5adae3649.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-d99667b199a9875a.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-51f4300e102199f5.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b3ccf1f7737a6a91.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-157c37a3ceb78853.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-505bcee45aafb736.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c29abd529ba4452b.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-895383a3232f6572.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-5594cb4f559bc761.rlib" "-Wl,--end-group" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-38e90baf978bc428.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: Non-UTF-8 output: /usr/bin/cc: 1: /usr/bin/cc: \x7fELF\x01\x01\x01\x02\x03\x01\xe4\x90: not found\n/usr/bin/cc: 4: /usr/bin/cc: Syntax error: \"(\" unexpected (expecting \")\")\n

error: aborting due to previous error

error: Could not compile `hello-rust`.

To learn more, run the command again with --verbose.
testwsl@localdesktop:~/hello-rust$ cc
-bash: /usr/bin/cc: cannot execute binary file: Exec format error
testwsl@localdesktop:~/hello-rust$ cargo run --verbose
   Compiling hello-rust v0.1.0 (/home/testwsl/hello-rust)
     Running `rustc --edition=2018 --crate-name hello_rust src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=61a6dbe3daa05864 -C extra-filename=-61a6dbe3daa05864 --out-dir /home/testwsl/hello-rust/target/debug/deps -C incremental=/home/testwsl/hello-rust/target/debug/incremental -L dependency=/home/testwsl/hello-rust/target/debug/deps`
error: linking with `cc` failed: exit code: 2
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.1vqvvt1zu5yjmkx2.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.35e6mijtpa61ekwc.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.3guttdxbl4ju2ho3.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.3w3apmysmbwmta20.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.555cq0ss6gtr2lhv.rcgu.o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.pnha9ks6selykbe.rcgu.o" "-o" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864" "/home/testwsl/hello-rust/target/debug/deps/hello_rust-61a6dbe3daa05864.2jltqdnkmdrx6xjn.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/testwsl/hello-rust/target/debug/deps" "-L" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-9895e8982b0a79e7.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-57306b8ed3378a0e.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-54463ae5adae3649.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-d99667b199a9875a.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-51f4300e102199f5.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b3ccf1f7737a6a91.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-157c37a3ceb78853.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-505bcee45aafb736.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c29abd529ba4452b.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-895383a3232f6572.rlib" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-5594cb4f559bc761.rlib" "-Wl,--end-group" "/home/testwsl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-38e90baf978bc428.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: Non-UTF-8 output: /usr/bin/cc: 1: /usr/bin/cc: \x7fELF\x01\x01\x01\x02\x03\x01\xe4\x90: not found\n/usr/bin/cc: 4: /usr/bin/cc: Syntax error: \"(\" unexpected (expecting \")\")\n

error: aborting due to previous error

error: Could not compile `hello-rust`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name hello_rust src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=61a6dbe3daa05864 -C extra-filename=-61a6dbe3daa05864 --out-dir /home/testwsl/hello-rust/target/debug/deps -C incremental=/home/testwsl/hello-rust/target/debug/incremental -L dependency=/home/testwsl/hello-rust/target/debug/deps` (exit code: 1)
testwsl@localdesktop:~/hello-rust$

【问题讨论】:

  • 显然,reddit 的某个人在 4 个月前遇到了同样的问题:reddit.com/r/rust/comments/b26f68/…。但是没有合适的解决方案,除了改变工具链。
  • 可能是工具链问题:github.com/rust-lang/rust/issues/51659
  • 在 Windows 10 上尝试使用 GTK 编译 Rust 程序时,我也遇到了 1181 错误(在 Debian 上运行相同)。我很确定我在 Windows 上的 gtk 安装很糟糕。当我有机会时,我会看看我是否可以解决这个问题。如果我确实找到了一个好的答案,我会在这里发布。

标签: rust rust-cargo


【解决方案1】:

下载并安装Build Tools for Visual Studio 2019。在安装过程中选择C++ 工具。它将下载近 5GB 的数据。然后重启机器安装后编译代码就可以正常工作了。

你也可以访问这个linker-link-exe-not-found

【讨论】:

    猜你喜欢
    • 2021-09-02
    • 1970-01-01
    • 2012-09-14
    • 1970-01-01
    • 1970-01-01
    • 2018-11-03
    • 2015-08-06
    • 2012-05-27
    • 1970-01-01
    相关资源
    最近更新 更多