Debugging Qt program with Microsoft VIsual Studio 2013
-
Hello!
I created a complex program based on different modules which load after program has started. The program structure is very similar to QtCreator. Frankly speaking I've taken part of code from QtCreator. (plugin management system)
I'm trying to debug my program with Visual Studio 2013. Very often the debugger doesn't show correct values and skip lines of code. It seems to me that pdb file doesn't correspond to the proper file. How is that may be possible? Should I set specific or additional parameters for debugging Qt programs in MSVS 2013? What might be the reason of such behaviour of debugger?I installed Qt 5.4.1 for Windows 32-bit (VS 2013, 705 MB) along with Visual Studio Add-in 1.2.4 for Qt5 (156 MB) properly.
-
Hello!
I created a complex program based on different modules which load after program has started. The program structure is very similar to QtCreator. Frankly speaking I've taken part of code from QtCreator. (plugin management system)
I'm trying to debug my program with Visual Studio 2013. Very often the debugger doesn't show correct values and skip lines of code. It seems to me that pdb file doesn't correspond to the proper file. How is that may be possible? Should I set specific or additional parameters for debugging Qt programs in MSVS 2013? What might be the reason of such behaviour of debugger?I installed Qt 5.4.1 for Windows 32-bit (VS 2013, 705 MB) along with Visual Studio Add-in 1.2.4 for Qt5 (156 MB) properly.
-
@rudshel
Hi and welcome to devnetIn most cases when the debugger does not follow the code lines as expected, it is simply a mismatch of code lines and objects.
Rerun qmake and make a rebuild which shall cure the problem. -
@koahnig
Thanks for the answer!
So, you mean I must run qmake in console outside of MSVS and then make a rebuild from MSVS?ps. I've made cleanup and rebuild several times within MSVS.
@rudshel
I have stopped using MSVC a while ago. Therefore I do not remember how to do it from MSVC.As you might know, you could use also Qt creator together with MSVC compiler.
In Qt creator you would basically "run qmake" and then "rebuild".
However, in my personal experience I found it sometimes saver to delete all compiled objects, libs and exes and did recompilation. Then you are sure than all is really compiled.
Note, this experience is merely based on using MinGW compiler suite.As far as I remember there is a db created by MSVC which holds all information for debugging. Extension .ndb(?). Make a copy and remove it as well.
-
@rudshel
I have stopped using MSVC a while ago. Therefore I do not remember how to do it from MSVC.As you might know, you could use also Qt creator together with MSVC compiler.
In Qt creator you would basically "run qmake" and then "rebuild".
However, in my personal experience I found it sometimes saver to delete all compiled objects, libs and exes and did recompilation. Then you are sure than all is really compiled.
Note, this experience is merely based on using MinGW compiler suite.As far as I remember there is a db created by MSVC which holds all information for debugging. Extension .ndb(?). Make a copy and remove it as well.
-
Finally I solved this problem.
Go to project property pages-> C/C++ ->Optimization. Set 'Optimization' property to 'Disabled(/Od)'. That's all! :)