Visual Studio 2012 的 C++ 命令行编译器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13428604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 17:17:53  来源:igfitidea点击:

C++ command line compiler for Visual Studio 2012

c++visual-studio-2012

提问by user1824407

I have installed Visual Studio Express 2012 and I have added cl.exeto my PATH but apparently is missing a dll ( ? ), the mspdb110.dll, I have also noticed that there are 2 cl.exein 2 different paths:

我已经安装了 Visual Studio Express 2012 并且我已经添加cl.exe到我的 PATH 但显然缺少一个 dll(?)mspdb110.dll,我还注意到cl.exe在 2 个不同的路径中有 2个:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64

how i can compile a file main.cppfrom the command line with the VS compiler ? Where I can find a reference for this compiler ?

如何main.cpp使用 VS 编译器从命令行编译文件?我在哪里可以找到这个编译器的参考?

Thanks.

谢谢。

回答by James McNellis

Run the vcvarsall.batbatch file from the VC directory under whatever directory you installed Visual Studio to (e.g., on my PC, it's in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC). This batch file will configure the environment for toolchain use.

在安装 Visual Studio 的任何目录下的 VC 目录中运行vcvarsall.bat批处理文件(例如,在我的 PC 上,它位于 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC)。此批处理文件将配置工具链使用的环境。

By default, it will configure the environment for use of the x86 native toolchain. You can also provide an argument to the batch file to use a different toolchain. For example, you can pass amd64to use the native x64 toolchain, or x86_amd64to use the x86 -> x64 cross compilation toolchain. Take a look at the contents of the batch file if you are interested in other options or what, exactly, it configures.

默认情况下,它将配置使用 x86 原生工具链的环境。您还可以为批处理文件提供参数以使用不同的工具链。例如,您可以通过amd64使用原生 x64 工具链,或x86_amd64使用 x86 -> x64 交叉编译工具链。如果您对其他选项或它配置的内容感兴趣,请查看批处理文件的内容。