无法编译简单的生锈程序

时间:2018-11-11 21:37:22

标签: rust rust-cargo rust-compiler-plugin

由于它是一种非常有前途的语言,所以今天我决定学习并开始使用锈编码。但是,我尝试在rust中编译并运行一个简单的Hello world程序,但由于某种原因却收到此错误。有人可以告诉我怎么了吗?

这是我的防锈码:

fn main(){
        println!("Hi");
}

,这是错误消息:

  

错误:与cc链接失败:退出代码:1 | =注意:“ cc”   “ -m64”“ -L”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib”   “” test.test.7rcbfp3g-cgu.0.rcgu.o“”“ test.test.7rcbfp3g-cgu.1.rcgu.o”   “” test.test.7rcbfp3g-cgu.2.rcgu.o“” test.test.7rcbfp3g-cgu.3.rcgu.o“   “” test.test.7rcbfp3g-cgu.4.rcgu.o“”“ test.test.7rcbfp3g-cgu.5.rcgu.o”   “ -o”“测试”“ test.5fi6c8ty3hqyycqf.rcgu.o”“ -Wl,-dead_strip”   “ -nodefaultlibs”“ -L”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-a5984f6fc2a4870f.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-7c9487d161f01b59.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-e146b9b98ab73364.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-acb39784a181deae.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-89f97a4bae8c89d2.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-cd336d4bb1fade3c.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-d6545438808205eb.rlib”   “ /Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-8aa8397108285683.rlib”   “ /用户/moo7md/.rustup/工具链/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-83c21e81fef8188c.rlib”   “ -lSystem”“ -lresolv”“ -lpthread”“ -lc”“ -lm” =注意:xcrun:错误:   无效的活动开发人员路径(/ Library / Developer / CommandLineTools),   在/ Library / Developer / CommandLineTools / usr / bin / xcrun中缺少xcrun

1 个答案:

答案 0 :(得分:2)

这是MacOS上非常普遍的问题。 您可以通过在终端中输入xcode-select --install来修复它。 这意味着未安装开发人员工具。