The program crashes in release mode
-
I have compiled program in VS 2008 (Qt 4.8.5) in release mode. Program uses DB Firebird. I run program from VS and all works fine, but when I try run program from Explorer or CMD.exe it crashes when it connect to DB.
Visual Studio 2008 Professional.
Windows XP 32bit -
I never worked with firebird, but this sounds like your program can't find some dependent libraries at runtime. Make sure that you have whatever library(dll) firebird requires in your app directory.
If you can't figure out what that is use Dependency Walker to check for dependencies.
-
[quote author="terenty" date="1385666052"]Hi,
As I understood your program runs fine in debug but crashes in release?
It could be due to uninitialized variables since they initialized to default in VS in debug mode. Also check your warnings in debug , there might be some hints[/quote]Hi Terenty,
Program works success in debug mode if it runs as from VS as from Explorer. In release mode it works only if it runs from VS. If I run program from Explorer it crashes when I try connect to DB -
[quote author="Chris Kawa" date="1385666148"]I never worked with firebird, but this sounds like your program can't find some dependent libraries at runtime. Make sure that you have whatever library(dll) firebird requires in your app directory.
If you can't figure out what that is use Dependency Walker to check for dependencies.[/quote]
Chris,
The strange for me that the program works well if it runs from VS, but not from Explorer. -
There's nothing strange about it.
When you run your program in the development environment IDE sets various additional stuff for you like environment variables, link locations, search paths etc.When you run an app outside of IDE it relies solely on the system paths. If it can't find a library at runtime in system locations (on windows that is exe location, PATH env variable and Windows/System32/SysWow64 folders) it gives up.
Debug mode runs also from outside IDE because debug binaries contain hardcoded paths to dependencies inside them for debug purposes. It still wouldn't work on another machine or if you move stuff around.Just look around this forum for "runs in IDE but doesn't outside". Tons of topics and 99.9% of the times it's bad deployment (missing libraries).
So again - there's almost certainly some .dll that your db engine is located in. Find out what that is and put it in the exe location.
You can find out which is it either by sniffing with Dependency Walker or check the Output window in VS when you run your app. It shows all the modules(dlls) it loads. -
Hi,
To add to Chris Kawa, have a look at "the Windows deployment guide":http://qt-project.org/doc/qt-4.8/deployment-windows.html
-
Hi, Maybe post the crash report if given? That might give some suggestion. What Chris says is very accurate! May sure your links and paths are correct for release. Maybe you should debug your way through your code and 'simulate' a non found dll. What does your code do when the DB isn't found, the pointer to it isn't loaded etc.
Even try to introduce exceptions in there?