您的位置:首页 > 其它

cl编译控制台可调式的程序

2012-08-24 19:31 190 查看
元旦要调到新的组,开始系统的学习C++,首选的书籍是《C++ Primer》。系统的学习有个好处就是很系统,尤其是当自己写过一段时间的代码之后帮助尤为明显。

安装了VS2008后,就可以在控制台下面编译自己的代码了首先执行文件:

C:/Program Files/Microsoft Visual Studio 9.0/VC/vcvarsall.bat 

 

再执行如下命令,main.cpp是要编译的文件名:

cl /EHsc main.cpp 

 

即可以编译生成exe文件。如果想在VC2008中调试代码的话,就是用一下的明令

cl main.cpp /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /W3 /nologo /ZI /TP /errorReport:prompt 

 

对应的选项帮助如下:

cl /EHsc main.cpp 

/Od disable optimizations (default) 

/D<name>{=|#}<text> define macro 

/Gm[-] enable minimal rebuild 

/EHs enable C++ EH (no SEH exceptions) 

/EHc extern "C" defaults to nothrow 

/RTC1 Enable fast checks (/RTCsu) 

/MDd link with MSVCRTD.LIB debug lib 

/w<l><n> set warning level 1-4 for n 

/nologo suppress copyright message 

/Zi enable debugging information 

/Tp<source file> compile file as .cpp 

/errorReport:option Report internal compiler errors to Microsoft 

    none - do not send report 

    prompt - prompt to immediately send report 

    queue - at next admin logon, prompt to send report (default) 

    send - send report automatically 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: