Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual c++ 为MSVC工具链的Rust build提供编译器标志_Visual C++_Rust_Rust Cargo - Fatal编程技术网

Visual c++ 为MSVC工具链的Rust build提供编译器标志

Visual c++ 为MSVC工具链的Rust build提供编译器标志,visual-c++,rust,rust-cargo,Visual C++,Rust,Rust Cargo,我希望使用MSVC工具链为Windows上构建的Rust应用程序启用编译器选项。我看到rustc提供了选项“-C llvm args”来为llvm工具链提供标志,但我没有看到MSVC有这样的选项。目前是否存在对rustc或cargo的这种支持?rustc是Rust编译器,它依赖LLVM后端在所有平台上生成实际代码。因此,如果需要将参数传递到后端,可以在Windows上像在其他平台上一样使用-C llvm args MSVC工具链和MINGW工具链之间的区别主要涉及链接器。选项可以通过所有平台或在

我希望使用MSVC工具链为Windows上构建的Rust应用程序启用编译器选项。我看到rustc提供了选项“-C llvm args”来为llvm工具链提供标志,但我没有看到MSVC有这样的选项。目前是否存在对rustc或cargo的这种支持?

rustc是Rust编译器,它依赖LLVM后端在所有平台上生成实际代码。因此,如果需要将参数传递到后端,可以在Windows上像在其他平台上一样使用
-C llvm args


MSVC工具链和MINGW工具链之间的区别主要涉及链接器。选项可以通过所有平台或在所有平台上传递给链接器,当然,在这种情况下,可用的选项将取决于目标工具链。

请注意,rustc从不使用MSVC编译器,而只使用MSVC链接器。您可以使用或将选项传递给链接器。@Jmb rustc在Windows上使用什么编译器?rustc是编译器,因此它不使用任何其他编译器。但是,它依赖LLVM后端在所有平台上生成实际代码。因此,如果需要将参数传递到后端,可以在Windows上像在其他平台上一样使用
-C llvm args
。@Jmb谢谢,这回答了我的问题。你能把它作为答案贴出来让我接受吗?