Symptoms: Can’t set breakpoint, the line shows hollow yellow circle with exclamation.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
A. It complains that: The code doesn’t match the pdb.
B. It complains that: The code can’t currently be hit. Invalid file line: N. However, actually through the module window, the pdb for this dll has been loaded.
Possible Solutions:
1) Make sure that "Tools"->"Options"->"Debugging"->Uncheck "Require source files to exactly match the original version"(For A)
2) Verify whether in "Module" window, the pdb(debug symbol) has been loaded.
3) Check the project setting,
a. C/C++ -> General -> Debug Information Format -> Program Database (Zi) or ZI
b.Optimization: Disabled (/Od). Actually this option should not affect whether it's debuggable, but it's better to set this for debug convenience.
c. Code Generation: Runtime Library -> Multi-threaded Debug DLL (/MDd)
d. Linker -> Debugging -> Generate Debug Info : Yes (/DEBUG)
4) Verify than the pdb is outputed to the correct location.
If it's general dll/exe, the output lib, dll, exe are specified by General: Output Directory
If it's static library, the output lib file location is specified by "Librarian"->General->Output File->XXX\YYY.lib
No matter it's dll/exe or static library, the pdb is specified at : C/C++ -> Output Files -> Program Database File Name : XXX\YYY.pdb
5) Check the setting that: General -> common Language Runtime Support : No Common Language Runtime support, and delete AssemblyInfo.cpp(for B). Then it can debug either dll or static library.
Note: a project can by a dynamic link dll(It has dll, lib), or a static lib(only lib, not dll). And static lib don’t need to export any class/method.
转载于:https://blog.51cto.com/yongkai/288641