命令行编译使用cl.exe? [英] Command line compile using cl.exe?
问题描述
我试图使用Visual Studio Express 2010 C ++编译器,而不使用IDE。我在C:\Program文件(x86)\ Microsoft Micro Visual Studio 10.0 \VC \bin中找到cl.exe。然而我有一些困难。首先,它给了我一个警告弹出,当我键入cl说'程序无法启动,因为mspdb100.dll从您的计算机丢失。
Am trying to use the Visual Studio Express 2010 C++ compiler without using the IDE. I found cl.exe in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin. However am having a few difficulties. Firstly it gave me a warning pop up when i type cl saying 'Program cannot start because mspdb100.dll is missing from your computer.'
所以我添加C:\\程序文件(x86)\Microsoft Visual Studio 10.0 \Common7 \IDE到系统路径,然后重试,但这次:
So i add C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE to the system path and then try again, but this time:
致命错误C1510:无法加载语言资源clui.dll。
fatal error C1510: Cannot load language resource clui.dll.
任何想法如何解决这个问题,这样我可以编译?另外如何设置的路径,所以我可以只输入'cl main.cpp'等,从不包含cl.exe的解决方案文件夹内。目前我必须在bin文件夹。谢谢。
Any idea how to solve this so i can compile? Also how would i set up the path so i can just type 'cl main.cpp' etc, from within a solution folder that does not contain cl.exe. At the moment i have to be inside bin folder. Thanks.
推荐答案
尝试从
Start->
All Programs ->
Microsoft Visual Studio 2010 ->
Visual Studio Tools ->
Visual Studio Command Prompt 2010
或者,您可以通过运行此命令来设置环境命令提示符:
Alternatively, you can set up the environment by running this in a command prompt:
"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
(注意:这将在运行后设置您的环境。)
(note: this will leave your environment set up after running.)
(注意2:根据需要更改 x86
选项为 x86
ia64
, amd64
, x86_amd64
, x86_ia64
)
(note2: change x86
as desired. options are x86
, ia64
, amd64
, x86_amd64
, x86_ia64
)
从这里可以运行 cl.exe
。如果您希望每当您运行 cl
时自动完成此操作并撤消,请创建一个包含此内容的批处理文件:
From there you can run cl.exe
. If you want this to be automatically done and undone whenever you run cl
, create a batch file with this content:
@echo off
%comspec% /c ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 && cl.exe %*"
( / c
告诉命令提示符,在运行此命令后结束会话,因此您的环境将恢复正常。)
(the /c
tells the command prompt to end the session after running this command, so your environment returns to normal.)
c> cl.bat 。将它放在某处的某个文件夹中,并将该文件夹的路径添加到 PATH
环境变量,确保它在之前< c $ c> cl.exe ,以便在输入 cl $ c时执行
cl.bat
$ c>而不是 cl.exe
From there, name it cl.bat
. Put this in a folder somewhere, and add the path to that folder to your PATH
environment variable, making sure it comes before the path to cl.exe
, so that this cl.bat
is executed whenever you type cl
instead of cl.exe
我建议你把 cl.bat
在
system32 /
文件夹中,它应该在 cl.exe
默认安装。
I recommend you just put cl.bat
in your system32/
folder, it should come before cl.exe
's path on a default installation.
或者,您可以以任何顺序添加它,并始终输入 cl.bat
没有混乱。
Alternatively, you can add it in any order and always type cl.bat
, or name it something else so there's no confusion.
这篇关于命令行编译使用cl.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!