MinGW 4.7.2的Qt应用程序分段错误 [英] Qt Application segmentation fault with MinGW 4.7.2
问题描述
使用MinGW 4.7.2编译的每个Qt 4应用程序都会崩溃-甚至包括之前运行的程序.
Using MinGW 4.7.2 every compiled Qt 4 application crashes - even programs that ran before.
- MinGW: 4.7.2
- QT: 4.8.3
- 使用的库:
- QtCore4.dll
- QtCored4.dll
- QtGui4.dll (用于gui)
- QtGuid4.dll (用于gui)
- MinGW: 4.7.2
- QT: 4.8.3
- Used Libs:
- QtCore4.dll
- QtCored4.dll
- QtGui4.dll (used if gui)
- QtGuid4.dll (used if gui)
以简单程序为例:
#include <QtGui/QApplication> int main(int argc, char *argv[]) { QApplication app(argc, argv); /* Crash here */ return app.exec(); }
崩溃: 收到的信号:SIGSEGV(分段错误)
呼叫堆栈:
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); [...]
推荐答案
您将需要MinGW 4.4.要使用MinGW 4.7.2,您需要自己编译Qt.崩溃是由于MinGW版本之间的ABI不兼容造成的.
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.
有关如何构建Qt的信息,请参见:
See this on how to build Qt:
http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW
通常,在下载Qt时,请注意其构建所用的MinGW版本.如果要使用自己的MinGW安装,则该版本必须与构建Qt的版本相同.
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.
这篇关于MinGW 4.7.2的Qt应用程序分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!