QT app i made exited with code -1073741515 - qt

I have coded a program in QTcreator on linux and when i tried to port it to windows.
Program compiles without any errors.
But when i run the program it exits automatically
Starting C:\Projects\LIG\debug\LIGenerator.exe...
C:\Projects\LIG\debug\LIGenerator.exe exited with code -1073741515
I tried to debug it using QT creator debugger. But flow of the program does not pass even through main.cpp
how to debug the program and fine where is the errors.
Update
In the .pro file the INCLUDEPATH and LIB are the following
win32:INCLUDEPATH += "C:\Program Files\Expat 2.0.1\Source\lib"
win32:INCLUDEPATH += "E:\confuse-2.7\confuse-2.7\src"
win32:INCLUDEPATH += "C:\Projects\LithologyInputGenerator5\XML"
win32:LIBS += -L"C:/Program Files/Expat 2.0.1/Bin" \
-L"C:/Program Files/GnuWin32/lib/" \
-L"E:/confuse-2.7/confuse-2.7/windows/msvs.net/libConfuse/Release"
LIBS += -lexpat \
-lcrypto \
-lssl\
-lconfuse
unix:LIBS += libgsoap++.a \
-lgsoap
win32:LIBS += -lwsock32
Update
I have used dependency walker as mentioned which help me to find the missing dependencies. I have now fixed all the dependencies except MPR.DLL ( Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.). IT was not missing so i left it out.
Also i have used a configuration file. I have now copied the conf file to debug dir for WIN32 compiler.I don't remember whether i have used more than one conf file
Still the program automatically exit with code -1073741515
. I tried to debug program using GUI debugger . But program is not even breaking at main also.
Could any one help me to get out of the this?

-1073741515 is the same as 0xC0000135 which I think often is because a a dependency is missing. I'd suggest checking that all DLLs your app depends on are in the correct locations.
You can use Dependency Walker for this.

I had the same problem, fixed by changing project settings Projects -> Tool chain -> MinGW (x86 32bit)

Related

Crash in debug mode along with CDB process termination, but release mode is fine

My application builds and runs fine in Release mode. However, in Debug mode, my application crashes. When trying to use debugger to pinpoint the crash cause, such error is received:
Qt Creator unexpected CDB exit
The CDB process terminated
What could possibly be the problem cause?
UPDATE
I built and deployed the application in Debug mode and then tried to run the executable by command like:
C:\Users\m3\Documents\deployment_folder>.\application.exe
and I received this message:
The code execution cannot be proceed because tbb_debug.dll was not found. Reinstalling the program may fix this problem.
For some reason, tbb.dll can be found in Release mode but tbb_debug.dll cannot be found in debug mode. Although all TBB DLLs are in the same directory. Not sure why ...
UPDATE
I'm adding TBB to my project with QMake like this:
INCLUDEPATH += deps/tbb-2020.3-win/tbb/include
# Looks like absolute path works for LIBS, but NOT relative path
win32: CONFIG (release, debug|release): {
LIBS += -LC:\Users\m3\repos\myapp\deps\tbb-2020.3-win\tbb\lib\intel64\vc14 \
-ltbb \
-ltbb_preview \
-ltbbbind \
-ltbbmalloc \
-ltbbmalloc_proxy \
-ltbbproxy
} else: win32: CONFIG (debug, debug|release): {
LIBS += -LC:\Users\m3\repos\myapp\deps\tbb-2020.3-win\tbb\lib\intel64\vc14 \
-ltbb_debug \
-ltbb_preview_debug \
-ltbbbind_debug \
-ltbbmalloc_debug \
-ltbbmalloc_proxy_debug \
-ltbbproxy_debug
} else: unix: { # Linux and mac
# TODO: add correct path to LIBS +=
}
The problem is resolved by manually copying TBB DLLs next to the application executable.
Copy from ... /tbb-2020.3-win/tbb/bin/intel64/vc14/*.dll to executable location.
On why release mode worked
I think some 3rd party application has already added tbb.dll to may PATH environment variable. But tbb_debug.dll is not added to PATH by any application. Just a guess ...

Qt Deployment error 0xc0000007b on Windows

I have a Qt 5.12 Windows app. I'm using Qt Creator and Mingw 64 bit.
I've deployed the app by windeployqt.exe. When I start it, the app requires the libgcc_s_seh-1.dll file. After I paste it in the dir, I get the 0xc000007b error. I ran Dependency Walker and it gives me the following errors:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
This is my .pro file
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Control
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
QMAKE_LFLAGS += -static-libgcc
##CONFIG += c++11
##QMAKE_CXXFLAGS += -std=c++0x
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Can someone help me? Thank you very much.
I had a similar problem in the past, but I am not pretty sure if it's the same reason because I was compiling with MVSC.
In my case, the application internally links with x86 dependency files. I did download and install x64 dependency files and link with x64 files.
Anyway, the old version of Dependency Walker doesn't know to skip 32-bit DLLs in PATH when processing a 64-bit EXE or DLL the way Windows does, so some errors are not really relevant. You may find more information in this post.
If the problem remains, try to avoid the usage of a static version of libgcc, acording to this post. It is not designed to be statically linked.
...
#QMAKE_LFLAGS += -static-libgcc
...
I got that error when the compiled app could not see the Qt dlls, so check your path. It could also be that it cannot find other gcc dll, like libwinpthread-1.dll.

Qt running error "Executable does not exist"

I installed Qt version 5 on Mac OSX and tried to build a simple project found on a book.
The project at first compiled and run correctly then I tried to do Clean all and Build all. At this point it seems to compile correctly, but when I try to run it, I am getting the following error:
Executable /Users/myMac/build-project_name-Desktop_Qt_5_5_1_clang_64bit-Debug/project_name.app/Contents/MacOS/project_name does not exist
Notice that the project folder is /Users/myMac/project_name
I had also to modify the file *.pro by adding QT += widgets because I got also the TARGET is empty error.
I tried to look for older questions but I did not find anything useful. Does anyone have any suggestion?
Here is my .pro file:
######################################################################
# Automatically generated by qmake (2.01a) Sun Mar 20 21:45:06 2016
######################################################################
QT += widgets
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += finddialog.h mainwindow.h
FORMS += mainwindow.ui
SOURCES += finddialog.cpp main.cpp mainwindow.cpp`
I needed to exit and restart QtCreator to fix a similar issue, although my error is slightly different from the OP's.
I am using CMakeLists.txt projects in QtCreator and we have a complicated cross-platform set of hundreds of projects.
Here is what led to my problem and I just reproduced it in Qt Creator 4.4.0 to verify the steps:
I added a new, command-line utility project in a subdirectory (i.e. add_subdirectory in CMake) by copying another similar project - I forgot to change the name
I ran CMake and it failed because the name was defined previously
I corrected the name of the new project (to 'a_exp')
I reran CMake successfully and QtCreator located the new project, a_exp
I used QtCreator to build the executable, a_exp
I confirmed in the shell that I could run the executable, a_exp
When I attempted to run in QtCreator, I got an error like the OP
Here is the error:
Starting a_exp...
Executable a_exp does not exist.

Linking opencv ".a" libraries with mingw and Qt 5.0

This one is tough ! Please don't mistake this for a newbie question ;) I have far too many miles in this OpenCV + MinGW static stuff for the simple mistakes....
Environment:
a. Qt 5.0.1 built with MinGW (the standard opensource download from qt-project) - so everything is built with the same MinGW environment.
b. Using CMake I setup minimal build (using the same g++/gcc as Qt) and turned OFF SHARED_LIBRARIES.
c. generated the cmake + mingw32-make + mingw32-make install works fine.
up till here everything looks pretty smooth ...
Now when I added:
win32-g++:INCLUDEPATH += D:/Dev/opencv/build/install/include
win32-g++:LIBS += -LD:/Dev/opencv/build/install/lib
win32-g++:LIBS += -static
win32-g++:LIBS += -llibopencv_core243d
win32-g++:LIBS += -llibopencv_imgproc243d
win32-g++:LIBS += -llibopencv_highgui243d
(and also without the "win32-g++" addition..)
I get d:/dev/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibopencv_highgui243d
...
...
now.. I do have libopencv_highgui243d.a in the right directory, but the ld.exe linker is ignoring anything else than a lib ! which supposed to be a MS library (which I wanted to avoid in the first place!!!) - I even tried to rename the .a files to .lib which caused the linker to regard the files, but show many "unreferenced" errors...
So who's to blame? the linker? CMake? mingw? Qt? ....
I tried many command line / flag options but without success ..
You should be referring to the libraries as:
LIBS += -lopencv_core243d
LIBS += -lopencv_imgproc243d
LIBS += -lopencv_highgui243d
Since -l already inserts lib at the beginning of the name.

Qt Creator release mode undefined references to std::out_of_range

I'm writing a small C++ program (with a GUI) with Qt Creator and compiling with MinGW. Everything works fine when I compile the project in debug mode but as soon as I move to release mode I get compiler errors:
undefined reference to 'std::out_of_range::~out_of_range()' thread.cpp
When I click on the error I also get:
File not found: thread.cpp
I have looked through my Boost installation and found thread.cpp and it should be on the include path for my project.
Any ideas?
EDIT: Here is my .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2012-08-10T12:09:39
#
#-------------------------------------------------
QT += core gui
TARGET = GeneDropWin
TEMPLATE = app
SOURCES += main.cpp \
genedrop.cpp \
mainbody.cpp \
biofunctions.cpp \
fileio.cpp \
settings.cpp
HEADERS += genedrop.h \
geneclasses.h \
paramclass.h \
mainbody.h \
biofunctions.h \
fileio.h \
geneclasses.h \
settings.h
FORMS += genedrop.ui \
settings.ui
#Stuff I've added
INCLUDEPATH += "C:\\Program Files\\boost_1_50_0"
LIBS += -L"C:\\Program Files\\boost_1_50_0\\stage\\lib" -lboost_thread-mgw46-mt-1_50 -lboost_system-mgw46-mt-1_50 -lboost_date_time-mgw46-mt-1_50 -lboost_chrono-mgw46-mt-1_50
CONFIG += static \
release
RESOURCES += \
NIABLogo.qrc
Ok, the problem is fixed but perhaps not completely understood. I fixed it by switching compiler to MSVC and changing the syntax for the linker options (e.g. -lboost_thread-mgw46-mt-1_50 -> -llibboost_thread-vc100-mt-1_50), compiles without an issue now. I will put forward my reasoning as to what I think may have been the problem but would appreciate a better answer if wrong:
Although I thought I had built the Boost libraries with MinGW when looking through the installation I found a number of folders mentioning msvc instead (e.g. ...boost\bin.v2\libs\date_time\build_msvc-10.0) which suggested to me that I had built it with MSVC.
The linker error claimed not to be able to find files associated with thread.cpp.
Looking at the thread folder of the build directory all the .obj and .lib files had msvc-10.0 folders in their path.
Thus I think that the MinGW compiler was looking for boost objects within a non-existent MinGW folder and so was failing. The fact that it worked under debug mode I guess relates to a less-constrained search for files.

Resources