問題描述
我試圖在不使用 IDE 的情況下使用 Visual Studio Express 2010 C++ 編譯器.我在 C:Program Files (x86)Microsoft Visual Studio 10.0VCin 中找到了 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.0VCin. 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:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE 添加到系統(tǒng)路徑,然后再試一次,但這次:
So i add C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE to the system path and then try again, but this time:
致命錯誤 C1510:無法加載語言資源 clui.dll.
fatal error C1510: Cannot load language resource clui.dll.
知道如何解決這個問題以便我可以編譯嗎?另外,我將如何設(shè)置路徑,以便我可以從不包含 cl.exe 的解決方案文件夾中鍵入cl main.cpp"等.目前我必須在 bin 文件夾內(nèi).謝謝.
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
或者,您可以通過在命令提示符下運行來設(shè)置環(huán)境:
Alternatively, you can set up the environment by running this in a command prompt:
"c:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" x86
(注意:這將在運行后保留您的環(huán)境設(shè)置.)
(note: this will leave your environment set up after running.)
(注意2:根據(jù)需要更改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
時自動完成和撤消此操作,請創(chuàng)建一個包含以下內(nèi)容的批處理文件:
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.0VCvcvarsall.bat" x86 && cl.exe %*"
(/c
告訴命令提示符在運行此命令后結(jié)束會話,以便您的環(huán)境恢復正常.)
(the /c
tells the command prompt to end the session after running this command, so your environment returns to normal.)
從那里,將其命名為 cl.bat
.將其放在某個文件夾中,并將該文件夾的路徑添加到您的 PATH
環(huán)境變量中,確保它位于 cl.exe 的路徑之前code>,以便在您鍵入
cl
而不是 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
,或?qū)⑵涿麨槠渌Q,以免混淆.
Alternatively, you can add it in any order and always type cl.bat
, or name it something else so there's no confusion.
這篇關(guān)于使用 cl.exe 進行命令行編譯?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!