Qt Application segmentation fault with MinGW 4.7.2

时光怂恿深爱的人放手 提交于 2019-12-19 03:37:20

问题


Using MinGW 4.7.2 every compiled Qt 4 application crashes - even programs that ran before.

  • MinGW: 4.7.2
  • QT: 4.8.3
  • Used Libs:
    • QtCore4.dll
    • QtCored4.dll
    • QtGui4.dll (used if gui)
    • QtGuid4.dll (used if gui)

Simple Program as an example:

#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv); /* Crash here */

    return app.exec();
}

Crash: Signal received: SIGSEGV (Segmentation fault)

Call Stack:

ZN23QCoreApplicationPrivate27processCommandLineArgumentsEv+68: mov    (%edx,%esi,1),%eax
ZN16QCoreApplication4initEv+88: lea    -0x8(%ebp),%esp
ZN16QCoreApplicationC2ER23QCoreApplicationPrivate+47: add    $0x24,%esp
ZN12QApplicationC1ERiPPci+75: movl   $0x67ef2768,(%ebx)
QApplication app(argc, argv);
[...]

回答1:


You will need MinGW 4.4. To use MinGW 4.7.2, you need to compile Qt yourself with it. The crash is due to ABI incompatibilities between the MinGW versions.

See this on how to build Qt:

http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW

In general, when downloading Qt, pay attention to the MinGW version it's been built with. If you want to use your own MinGW installation, it'll need to be the same version as the one Qt was built with.



来源:https://stackoverflow.com/questions/13962857/qt-application-segmentation-fault-with-mingw-4-7-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!