Saturday, January 20, 2007

VS 2005 could not debug C++ program

By default, you compile the C++ source codes and want to run it with debugging. You will get an 
information like "Could not find program.exe's debug info." or "Debug info is wrong, could not generate binary file".

Some people will think this is something wrong with his source codes, but it is the problem of his 
development environment. Bang~ You did not configure your Visual Studio correctly.

Solution:

Click the project properties, and get the property dialog pops up.   In the dialog, you can choose Debug Configuration, and modify the config properties. Under the "C/C++" tag in the property tree, you can see something insteresting to you on the right panel. There is a row called "Debug Info Format". By default, it is "Disable" or not configured.

If you want to make it works, just choose one option from the list clicked out. "C7 Compatible(/Z7)"/"Program Database(/Zi)" would be two of the possible options. In my case, I choose "C7 Compatible(/Z7)". It works when I re-debug the same program.

No comments: