Ricky Pusch

Hi everyone,

I am developing a QT application (using QT 3.2.0 Educational). After some time, I managed to get the application running through VS instead of at the command line. However, I simply used a QT-provided tool to convert a QT project (built in QT designer with .moc files and such) to a VS project. As such, it set up a bunch of the options in such a way that the debugger does not work. I try to set breakpoints, but they are never hit. It just tells me "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I went through the project properties, and tried messing around with various options, but nothing seemed to help. These lines are most definitely being executed, but when I run the program with the debugger active, it never halts.

I'm not sure if it's of any consequence, but there is only a Release build of my project. There is no way to switch to Active(Debug) instead of Active(Release) currently. I was under the impression that it's just a naming convention, so it is simply that the Release build doesn't have the right properties set to support debugging.

Can anyone help me with my problem Thanks to anyone who can. If you need more information about exactly what properties are set, please specify and I will provide those details. I think I'm just missing something simple in the settings, but I don't know enough about VS2005 to really know what.

EDIT - I tried converting the VS2003 project to a VS2005 project, and it worked and runs the same way, so I removed my first paragraph. This question is now about the options for a project in VS2005.


Re: Visual C++ General Setting up the debugger?

Simple Samples

 Ricky Pusch wrote:
There is no way to switch to Active(Debug) instead of Active(Release) currently.
That is the problem to solve. You must create a debug build to use the debugger. There are exceptions somewhat but there is no value in avoiding solving this problem the right way. There are many very important differences between release and debug builds.

 






Re: Visual C++ General Setting up the debugger?

Ricky Pusch

I do suppose that makes sense, as the Release build will not support the debugger. Is there an easy way to make a Debug build with befitting settings I tried creating a new build using the Configuration Manager, but I could only import settings from the current Release build, or start from scratch (which didn't even have "Generate Debug Info" checked, so I imagine the rest isn't set up either).

I'm sorry if this is a fairly straightforward and fundamental question, but I'm not sure all the fields that need to be set to have the debugger work properly. I'm used to a Debug build coming for free when I make a new project.




Re: Visual C++ General Setting up the debugger?

Simple Samples

Do you have a project (I hope many) that you have generated that you know works for both release and debug builds You can compare the properties for that project or those projects to get most or all of the differences. I list the differences that I see; all these are in the project properties page.

In the C/C++ node, select Optimization. At the top of the other pane is Optimization; disable it. The other stuff there should also be set to "No" or whatever. Then select Code Generation. For Runtime Libray use the debug version of the libraries. That is an important change but the only one I see there. Then select Preprocessor and at the top change "NDEBUG" to "_DEBUG".

In the Linker node select Debugging. There is one option that needs to be changed but I don't understand it. I hope you can find it.

I probably missed some of the options but I hope I have caught the important ones.






Re: Visual C++ General Setting up the debugger?

VikasKumar

To be able to debug a release build, or for any build you need the symbol files.

VS.NET does support building symbol files (PDB) even when you build a release build. To enable a release build generate PDB information change

"Generate Debug Info" in Project->Properties->Configuration Properties->Linker->Debugging to Yes (/Debug).

Turning off Optimization would not let compiler perform optimization on your code, I do belive that in release build you should let compiler optimize the code as it would identify the potential code where it can perform better.

The only problem with Release build debugging is that at times line by line execution might not seems possible, may be compiler had optimized some of the code, so do not get confused.





Re: Visual C++ General Setting up the debugger?

Ricky Pusch

Thanks everyone for your help. It had occurred to me late last night to just create a standard program that has a Debug and a Release build and go through and compare the two properties, but I was too tired to do that last night. Indeed, this has worked, and I am able to debug. For posterity, here is a list of the things I had to change. Hopefully this will help someone in the future.

C/C++
General
Debug Information Format - /ZI
Optimization
Optimization - Disabled
Preprocessor
Preprocessor Definitions - I had to list _DEBUG (instead of NDEBUG), and I also had to change QT_NO_DEBUG to QT_DEBUG
Code Generation
Basic Runtime Checks - Both
Runtime Library - Multi-threaded debug DLL

Linker
General
Enable Incremental Linking - Yes (though I don't think this matters much)
Debugging
Generate Debug Info - Yes





Re: Visual C++ General Setting up the debugger?

Jonathan Caves - MSFT

I just want to point out that you can also build a optimized build that has debug information - in fact this is how all Microsoft software is built.






Re: Visual C++ General Setting up the debugger?

Simple Samples

Ricky Pusch wrote:
Thanks everyone for your help. It had occurred to me late last night to just create a standard program that has a Debug and a Release build and go through and compare the two properties, but I was too tired to do that last night. Indeed, this has worked, and I am able to debug. For posterity, here is a list of the things I had to change. Hopefully this will help someone in the future.

C/C++
General
Debug Information Format - /ZI
Optimization
Optimization - Disabled
Preprocessor
Preprocessor Definitions - I had to list _DEBUG (instead of NDEBUG), and I also had to change QT_NO_DEBUG to QT_DEBUG
Code Generation
Basic Runtime Checks - Both
Runtime Library - Multi-threaded debug DLL

Linker
General
Enable Incremental Linking - Yes (though I don't think this matters much)
Debugging
Generate Debug Info - Yes

I spent so much time trying to help that I forgot to mention that if you don't have a project then you can generate one. I hope my suggestion did help inspire you to generate a project; I hope I did not waste time. I suppose the time I spent listing the changes that need to be made was in fact a waste of time.