元旦要調到新的組,開始系統的學習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