PDA

View Full Version : Release Mode Compiler Terminated with a Terrible Exception



waitingforzion
26th December 2009, 03:00
OK, my application works fine now, but when I try to build it in release mode, the compiler terminates with an error. It says an unknown software exception occurred. That really stinks because I was just about to put the final executable with the dlls and see how it runs.

bood
26th December 2009, 03:34
it's probably caused by accesses to some unexpected addresses (e.g. index of array out of range)
debug version usually doesn't have a so strict mechanism as the release version
please do more checks to your code

waitingforzion
26th December 2009, 03:49
it's probably caused by accesses to some unexpected addresses (e.g. index of array out of range)
debug version usually doesn't have a so strict mechanism as the release version
please do more checks to your code

I don't understand. Wouldn't an index out of range cause a runtime error, something that can only occur during the execution of the compiled program? I didn't even get the program built yet. The compiler itself terminated before it was built. But it works fine in debug mode.

g++.exe terminated, saying, "The exception unkown software exception (0x40000015) occurred in the application at location 0x0040ec01. Click ok to terminate the program. Now I don't understand how my code could have caused that. But I know you are more experienced and know more. So I just need help understanding what's wrong here.

nateriver
26th December 2009, 05:17
What version of gcc are you using (MinGW or Cygwin, and what version exactly)?
Is there anything that compiler outputs before this error occurs?
What version of Qt are you using?
Please write the exact procedure you do to compile your program (commands you enter) if you are using command prompt.

waitingforzion
26th December 2009, 05:25
I'm using Qt 4+ and whatever compiler comes with QtCreator.

1. I load my project in Qt Creator
2. I click Build > Set Build Configuration > Release
3. I click Build > Build All

Then it says this:

Running build steps for project Learning...
Starting: C:/Qt/2009.04/qt/bin/qmake.exe C:/Users/Guido/Documents/Learning/Learning.pro -spec win32-g++ -r CONFIG+=release
Exited with code 0.
Starting: C:/Qt/2009.04/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `C:/Users/Guido/Documents/Learning'
C:/Qt/2009.04/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Users/Guido/Documents/Learning'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\2009.04\qt\include\QtCore" -I"..\..\..\..\Qt\2009.04\qt\include\QtGui" -I"..\..\..\..\Qt\2009.04\qt\include" -I"..\..\..\..\Qt\2009.04\qt\include\ActiveQt" -I"release" -I"..\..\..\..\Qt\2009.04\qt\mkspecs\win32-g++" -o release\main.o main.cpp

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
mingw32-make[1]: Leaving directory `C:/Users/Guido/Documents/Learning'
mingw32-make: Leaving directory `C:/Users/Guido/Documents/Learning'
mingw32-make[1]: *** [release/main.o] Error 3
mingw32-make: *** [release] Error 2
Exited with code 2.
Error while building project Learning
When executing build step 'Make'

After which it displays the error message in my earlier post.

nateriver
26th December 2009, 06:12
Try using Qt 4.6 (it seems that you are using qt 4.5), maybe mingw bundled with previous versions was incompatible with Windows Vista.
Also try compiling your project from command line. Launch Qt Command Prompt (should be somewhere in your Start menu), enter your project's directory (cd "C:/Users/Guido/Documents/Learning/"), run "qmake -spec win32-g++ -r CONFIG+=release" and "mingw32-make -f Makefile.Release". If that doesn't make any difference, try to run just "qmake" without any parameters, and then run make command (the same as before).

waitingforzion
26th December 2009, 18:27
Try using Qt 4.6 (it seems that you are using qt 4.5), maybe mingw bundled with previous versions was incompatible with Windows Vista.
Also try compiling your project from command line. Launch Qt Command Prompt (should be somewhere in your Start menu), enter your project's directory (cd "C:/Users/Guido/Documents/Learning/"), run "qmake -spec win32-g++ -r CONFIG+=release" and "mingw32-make -f Makefile.Release". If that doesn't make any difference, try to run just "qmake" without any parameters, and then run make command (the same as before).

It works. Thank you.

But now how do I build the same project for the linux platform, without running qmake on linux?

franz
27th December 2009, 12:09
But now how do I build the same project for the linux platform, without running qmake on linux?

Why not use qmake? You'd have to write all build rules (including rcc, uic and moc) in a different build system (cmake, automake or (hard core) a Makefile) yourself.

nateriver
28th December 2009, 11:32
But now how do I build the same project for the linux platform, without running qmake on linux?

If you want to build your project for linux on windows, I doubt that it's possible, but who knows (need to check gcc's command line arguments)? :o
But if you want to distribute sources of your application for building on linux, you can just run qmake on your development machine and distribute your project with makefiles that qmake generated. However, qmake makes some assumptions when generating makefiles, for example it's configured to use gcc as compiler by default, so if somebody tries to compile your project using generated makefiles, he might have to manually edit it if gcc is not installed. In this case the best way is to use 'configure' scripts, but I've never used them, so can't really help, sorry.