QApplication segmentation error

When I try to create a QApplication object, I get a failure. This is my code:

 #include <QLabel> #include <QApplication> int main(int argc, char* argv[]) { QApplication app(argc, argv); return app.exec(); } 

I am using Qt version 4.8.4 and the MinGW compiler. My application crashes when I run the QCoreApplicationPrivate::processCommandLineArguments . Can anyone tell how to solve this problem?

+4
source share
1 answer

Apparently, this error is caused by binary incompatibility of Qt binaries and your compiler.

From here :

There are binary installers aimed at MinGW for Qt 4 and Qt 5. Qt 4 are built using aMinGW.org toolchain using gcc 4.4. Qt 5 is based on the MinGW-builds [sourceforge.net] toolchain using gcc 4.7.2. The Qt 5 installer also sends the toolchain itself.

If you are using gcc 4.7 (I think this is the default version with the latest MinGW version), you cannot compile (well, you can, but it will not work ) with the pre-installed Qt 4 binaries.

So, either downgrade gcc to 4.4, or upgrade Qt to the latest version (Qt 5).

+6
source

All Articles