Crash when run in Release mode?
-
@Mucip
You will (probably) have a bug in code which happens to show up in Release but not in Debug. This has been discussed before in this forum, e.g. uninitialised variable. It happens. Can be hard to trace down.Try running your Release executable under debugger. When it crashes inside debugger you still get trace back. If you are lucky, and it can see your source code, you may get enough to see where it is happening....
-
-
@Mucip said in Crash when run in Release mode?:
How can I run release executable under debuger?
In the same way you run a debug build
-
@Mucip said in Crash when run in Release mode?:
VS 2019
MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?
-
@J-Hilk ,
It's very strange!When I build in RELEASE mode I got crash and can not run under Qt Creator!
But when I run windployqt and create executable of the project than it works without any problem!
I can connect to PostgreSQL and use LimeReport and QtZint. I mean all the DLL's work without any problem.Project can be compiled in the release directory but can not be run via Qt... :(
Well, Where should be the problem?! I guess Qt must update something according to actual version of VS2019... :(
Regards,
Mucip:) -
I encounter this every so often. The cause is usually what JSulm suggested -- a missing library. If your project file isn't too big, I'd be interested in looking at it.
One thing I do when I encounter this, is go to the release directory and try to run the .exe directly (outside of Creator). You'll likely get an error message telling you what's wrong (eg, which library is missing).
-
Hi @mzimmers ,
If some DLL is misssing, It shouldn't be compiled. But QtCretator can compile the project.
Am I rigt?
By the way it shouldn't run in DEBUG mode either.P.S. Thanks a lot for your kind interest. Project is liitle bit long. :)
Regards,
Mucip:) -
@Mucip it's not that the .dll is missing - it's just not accessible to the release image. (I'm probably not the best one to explain this.) This would be a useful experiment: go into your build directory for your debug build. Find the executable and try to run it (this should work). Then go into the build directory for your release build, and do the same thing. I'm expecting you'll get an error message from the binary; if so, please post it.
-
Dear @mzimmers ,
Well, I tested in DEBUG directory. Clicked MriERP.exe file. Ofcourse it says LimeReport, QtZint and QtCore and etc files are missing. When I copy these files in the debug directory I can run the program in DEBUG folder.When I try same thing in RELEASE folder, error messages are the same. Same files are missing. I copied LimeReport, QtZint and Qt's DLL files than MriERP.exe files worked normally too.
A quick question: If some DLL are missing It shouldn't compile the project, should it?...
Regards,
Mucip:) -
Thanks for running those tests. I misspoke when I said the debug version should run; I forgot that the libraries aren't available outside of Creator. Since you probably don't intend to run your debug version outside of Qt, that's not important.
To fix your release build, you need to do (at least) two things:
- tell Creator which files (the ones you mentioned)you want to copy to your build directory. This can be done like this (in your .pro file):
my_release.files = "libexpat.lib" my_release.path = $$OUT_PWD INSTALLS += my_release
- in your build settings, you need to add a step after make, to do a make install. This will copy the files for you.
This should not work, but might not be exactly what you want. The user can run your program out of the release directory, but if he moves the executable, it won't run. If this presents a problem, let me know, and I'll tell you how to fix this (but it will take you some time to do so).
-
@mzimmers said in Crash when run in Release mode?:
my_release.files = "libexpat.lib"
my_release.path = $$OUT_PWDINSTALLS += my_release
Hi,
How can I put two dll files in the my_release.files? Should I add path also?By the way, what is changed after Qt 5.13.2? I didn't make this modification before? Why it happend in Qt 5.14.2?
By the way if I copy LimeReport.dll and QtZint.dll to RELEASE folder, I can run the program in Qt Creator. This mean the problem was LimeReport.dll and QtZint.dll files missing!
But why? It was working in Qt5.13.2 before???
Regards,
Mucip:) -
target.path = $$OUT_PWD target.files = "LimeReport.dll" "QtZint.dll" INSTALLS += target
This link OUT_PWD will explain how it works.
Just make sure to add the install step to your build. Adding this stuff to the .pro files is just specifying what the install will work on.
I can't answer why it worked in 5.13.
-
@mzimmers said in Crash when run in Release mode?:
target.path = $$OUT_PWD
target.files = "LimeReport.dll" "QtZint.dll"
INSTALLS += targetHi @mzimmers,
I copied above lines in my pro file and add make step to build like below picture. But still same crash?!
I affraid I could not copy dll's to destination folder. :(
Where am I wrong?...Regards,
Mucip:)