尝试创建 QApplication
时发生崩溃目的。这是我的代码:
#include <QLabel>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
return app.exec();
}
我使用的是 Qt 4.8.4 版和 MinGW 编译器。我的应用程序在运行时崩溃
QCoreApplicationPrivate::processCommandLineArguments
方法。谁能告诉如何解决这个问题?
最佳答案
显然,这个错误是由 Qt 二进制文件和你的编译器的二进制不兼容引起的。
来自 here :
There are binary installers targetting MinGW for both Qt 4 and Qt 5. The Qt 4 ones are built with aMinGW.org toolchain using gcc 4.4. The Qt 5 ones are based on a MinGW-builds toolchain [sourceforge.net] using gcc 4.7.2. The Qt 5 installer also ships the toolchain itself.
如果您使用的是 gcc 4.7(我认为这是最新 MinGW 的默认版本),则无法使用 Qt 4 预编译二进制文件进行编译(好吧,您可以,但是 it will not work )。
因此,要么将 gcc 降级到 4.4 版本,要么将 Qt 升级到最新(Qt 5)版本。
关于qt - QApplication段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14685425/