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.
Related
I am creating a GUI app with Qt creator to communicate with an esp32 and control the outputs. I am currently using Qt 6.4 version, I know lib is not available in 6.0 or 6.1 but I couldn't find anything on 6.4.
This pages advices to input QT += serial port; https://doc.qt.io/qt-6/qtserialport-index.html. In my Qt app my.pro file I declare this:
QT += core gui serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = serialRead
TEMPLATE = app
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
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
Error Message:
:-1: error: Project ERROR: Unknown module(s) in QT: serialport
I still dont know what to do to be able to use the QSerialPort library. I would appreciate any guidance. Thank you!
I solved the same issue with https://wiki.qt.io/Qt_Serial_Port
Install Perl (i.e Strawberry Perl)
Clone the qtserialport repo
git clone git://code.qt.io/qt/qtserialport.git
cd qtserialport
Checkout to suitable branch (you can list present branches with "git branch -a")
git checkout remotes/origin/6.3.1
Open qtserialport project with Qt Creator via CMakeLists.txt
In the "Projects" tab find "Build Steps" group, expand "Details" and check "install"
Rebuild the project from menu "Build->Rebuild"
It would be installed automatically. You may check it in the "Compile output". Note, that you have to rebuild the project for each build configuration you need.
Hope it will helps.
Use the application QT Maintenance Tool to add serialport lib.
Qt Creator is not parsing the include files in my project properly and gives a lot of errors in the IDE, including errors like main.cpp:14:5: error: unknown type name 'QApplication'. However, my project compiles perfectly fine. I am getting tired of all these supposed errors and am wondering if there is any way to fix this issue.
My .pro file looks like this:
QT += core gui widgets
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked 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 it uses 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
SOURCES += \
klocktimer.cpp \
main.cpp \
klockmainwindow.cpp \
chronometer.cpp
TRANSLATIONS += \
klock_en_US.ts \
klock_es_MX.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
klocktimer.h \
klockmainwindow.h \
chronometer.h
I had a hunch from a few days ago (I forget exactly how I got this hunch) that stddef.h was causing the problem. So I added #include <stddef.h> to my main.cpp, and Qt Creator gave the error:
/home/loren/code/klock/main.cpp:12: error: 'stddef.h' file not found
/usr/include/c++/9/ostream:42: to match this '{'
where the '{' is the beginning { in namespace std.
Somebody on the Qt forums told me to go to the Help Menu > About Plugins > Disable the ClangCodeModel plugin. This required a restart of Qt Creator, but it fixed my problem.
I work on Mac OS 10.8.5 and Qt 5.1.1 with among other things, qdebug class which work well with some projects and doesn't compile with some others. I've already tried to re-install Qt which didn't change a thing.
It is certainly due to the use of SDL library (?!) but it used to work fine. Here's a part of the compilation output :
In file included from ../../Stage/Joker/tests/SDLTest/main.cpp:7:
In file included from /Applications/QT/5.1.1/clang_64/include/QtCore/QDebug:1:
In file included from /Applications/QT/5.1.1/clang_64/include/QtCore/qdebug.h:46:
In file included from /Library/Frameworks/QtCore.framework/Headers/qhash.h:46:
/Library/Frameworks/QtCore.framework/Headers/qchar.h:76:5: error: unknown type name 'QT_ASCII_CAST_WARN_CONSTRUCTOR'
QT_ASCII_CAST_WARN_CONSTRUCTOR QChar(char c);
^
If needed, I can provide more output or unworking Qt classes.
I build my code with Qt => Build => Run
Unfortunatly, I'm unable to reproduce the code on an other computer.
Here's the pro file (which work well with all my co-workers, except me) :
TEMPLATE = app
SOURCES += main.cpp
OBJECTIVE_HEADERS += ../../libs/PhGraphic/SDLMain.h
OBJECTIVE_SOURCES += ../../libs/PhGraphic/SDLMain.m
LIBS += -framework Cocoa
QMAKE_CXXFLAGS += -F/Library/Frameworks
QMAKE_OBJECTIVE_CFLAGS += -F/Library/Frameworks
LIBS += -F/Library/Frameworks
LIBS += -framework SDL -framework SDL_image -framework SDL_ttf
I'd once had this problem after installing a software: it created a QtCore.framework in the /Library/Framework folder that overrided the QtCore of your current Qt kit (due to QMAKE_CXXFLAGS += -F/Library/Frameworks).
It's qDebug, and there are two overloads:
a stream-returning function
qDebug() << "foo";
a printf-style function
qDebug("foo");
You need to provide a minimum reproducible test case for us to help you.
How are you building your code? Are you using qmake to produce the Makefile? We'd need to see the .pro file at the minimum, and please minimize it by removing useless boilerplate comments etc.
A problem with a Qt *.pro file:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT += core
QT += gui
LIBS += -LC:\\Qt\\4.8.5\\bin
LIBS += -LC:\\Qt\\4.8.5\\lib
LIBS += -LS:\\lib
# LIBS += -lQtCored4 # not necessary
# LIBS += -lQtCore4
# LIBS += -lQtGuid4
# LIBS += -lQtGui4
SOURCES += ...
HEADERS += ...
I get these linker errors:
:-1: error: cannot find -lQtGuid
:-1: error: cannot find -lQtCored
collect2.exe:-1: error: error: ld returned 1 exit status
All the DLLs exist in the specified directories.
The documentation did not help much.
This pro file worked a few days ago, and it seems to have issues since I installed Qt 5.1 (this is not used, yet; I am still working with Qt4).
Platform: Windows 7, MinGW, Qt 4.8.4
You only need the following content:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT -= gui
SOURCES += ...
HEADERS += ...
That is because core and gui are added to the QT variable automatically. In this particular case however, you can remove the gui default if you wish to build a console application as you seem. Although "CONFIG += console" could eventually do that for you. Besides this, everything will work automatically for you, so you do not need to pass the library path to the qt libraries and so forth. You would only need to use QT += widgets and similar lines if you used further Qt modules there are not there by default. Even then, you would not need to set the Qt library path as you did in your question.
Besides, if you wanna target cross-platform later, you may wish to add this:
CONFIG -= app_bundle
to avoid creating Mac bundle for console based applications.
If you have multiple versions of Qt installed as it seems, you need to use the qmake from the required version, and it will be fine. Just to give an example: I use qmake for Qt 5 on my Archlinux system, and qmake-qt4 for Qt4.
On windows, you should either have the desired qt installation bin in the path before the undesired, or you need to call desired qmake explicitly, something like C:\path\to\my\desired\qmake.
There's no need to link to any Qt libraries afaik.
If you're using Qt Creator you need to make sure Qt 4.8.4 is properly recognized in Tools - Options - Build & Run - Kits. Since you installed 5.1 this may no longer be true. Then set the 4.8.4 kit for your project and compile it (cleaning the build directory also helps sometimes).
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)