When I was about to debug C++ program in VS2005,the program didn't stop at the breakpoints.
The VS said"No symbols are loaded for any call stack frame. The source code cannot be displayed".
What can I do?
When I was about to debug C++ program in VS2005,the program didn't stop at the breakpoints.
The VS said"No symbols are loaded for any call stack frame. The source code cannot be displayed".
What can I do?
maybe the compiled version differes from the source in vs ...
It sounds like you're attaching to a process rather than running a conventional debug session? If you are indeed attaching to a process, it is important to ensure that binaries that you are trying to debug were built with the same source code currently open in your IDE.
For whatever reason you don't have the right symbols (.pdb files) in the symbol path. This could be for several reasons:
1) Your binary was compiled more recently than the .pdb files. Try recompiling everything.
2) You are trying to debug a .dll and forgot to copy the .pdb files. Copy those files too.
It's also possible that your code isn't being executed like you think.
A few steps to try:
I have tried once more.
And the IDE said:"Debugging information for *.exe cannot be found or does not match.Binary was not built with debug information."
I cannot find a *.pdb file in the project directory either.
Frustrated.
I've experienced this problem (using c# in VS) when trying to debug my unit tests.
You can add the following code that will launch a new instance of the debugger that will allow you yo step through your code like normal:
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();
Thanks to everybody.
Finally,I found a solution here.
To enable debugging:
1) Goto Project->HelloWorld Properties
2) On the left expand "Configuration Properties"
3) Expand "C/C++"
4) On the left, Select "General"
5) On the right, change "Debug Information Format" to "Program Database For Edit And Continue (/ZI)"
5) On the left, Select "Optimization"
6) On the right, change "Optimization" to "Disabled (/Od)"
7) On the left, expand "Linker"
8) On the left, select "Debugging"
9) On the right, change "Generate Debug Info" to "Yes"
10) Click ok
11) Set your breakpoints
12) Rebuild your application
Also when running your application use Ctrl+F5 to build and run it, this keeps the console window open long enough for you to see your output.