重裝VS2005仍舊沒法解決該問題。 c++
雖然在解決方案配置中是DEBUG,可是我在程序中設置的斷點進不去,網上一查終於明白了 優化
其實問題在於,在空項目中不生成調試文件pdb,因此沒法調試。 ui
要讓項目生成pdb文件,須要更改:
項目屬性,configuration properties->linker->Generate Debug Info 從 no 改成 yes spa
(項目屬性:屬性->鏈接器->調試->生成鏈接信息 改成"是")
但這樣仍是不夠的,還須要更改:
項目屬性,configuration properties->c/c++->debug information format爲/ZI debug
(項目屬性:屬性->c++ ->常規 -> 調試信息格式 爲/ZI )
項目屬性,configuration properties->c/c++->optimization爲Disabled 調試
(項目屬性:屬性->c++ -> 優化 改成禁用
由於爲了生成這個文件,須要設定debug信息的格式並關掉O2,還要更改linker生成調試信息的開關 orm
若是有興趣diff項目的.vcproj文件,會發現更改了裏面的三行配置信息:
<Tool
Name="VCCLCompilerTool"
Optimization="0" //原來是2
DebugInformationFormat="4" //原來是0
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true" //原來是false ci
/> rem
Vc6.0中不能啓動debug,作以下修改: io
Project Setting設置如下幾項: 1) C++: Optimizations->Disable(Debug), Debug Info->Program Database for... 2) Link: Generate debug info, Link incrementally 3)clean--build |