Solved Debugging my C++ application
-
Unfortunately this won't even compile. I now have an idea what might be the problem. I compiled the taglib.dll some time ago. So maybe it is now incompatible with Qt 5.7 built by newer GCC.
So I tried to compile TagLib using the MinGW binary which comes with Qt. I recompiled the library and replaced the old one with this. Now the application won't even start and right crashes. Again without any useful information about the crash.
-
Hi,
Are you sure that the TagLib .dll can be found when your application starts ?
-
Yes, the library can be found. I think I would get an error about it and the application would not even start.
This is what I discovered so far:
- Qt 5.6 and TagLib compiled with GCC 4.9 - no problems
- Qt 5.7 and TagLib compiled with GCC 4.9 - random crashes when using the library
- Qt 5.7 and TagLib compiled with GCC 5.3 - immediate crash
The .dll files are in the same place, nothing is different, only the Qt version and GCC version used to compile TagLib. Is it possible that TagLib is not compatible with GCC 5.x? This is probably not the right place to ask this question.
But my original problem seems to be case by the incompatibility of GCC 4.9 compiled library with GCC 5.3 compiled Qt. And it can not be solved by recompiling the library with GCC 5.3. So for now I reverted back to Qt 5.6 where everything works as expected.
-
Did you enable C++11 when building TagLib for Qt 5.7 ?
-
No, I did not. However I don't know if it was enabled or not. I used CMake-gui and then mingw32-make from command line. How can i enable or disable C++ 11 in this toolchain?
-
See here for how to enable c++11 with cmake
-
I tried to enable C++11 when compiling TagLib but it still crashes with Qt 5.7 right after program start.
-
Can you run a simple application with only TagLib and not Qt code involved ?
-
So have you tried running it under a debugger ?
-
@SGaist Thank you for the tip. It helped me to solve the crash. The TagLib source contains also some examples so I built them too. When trying to run it, it complained about missing zlib1.dll. And that was also the problem in QtCreator. I compiled the LagLib library with ZLib support but I didn't copy the zlib1.dll to the build directory. Now with TagLib compiled using GCC 5.3 with C++ 11 enabled, my application works fine also with Qt 5.7.
@KeithS No, I did not. That was my original question, how should I use a debugger so I don't have to use my usual try-error approach. This problem is now solved but I would still appreciate some information source/guide where I could study how to use it.
-
Try this one. Also this video might be helpful.