Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在app.exec()上使用MSVC崩溃编译Qt程序_C++_Qt_Visual C++_Mingw - Fatal编程技术网

C++ 在app.exec()上使用MSVC崩溃编译Qt程序

C++ 在app.exec()上使用MSVC崩溃编译Qt程序,c++,qt,visual-c++,mingw,C++,Qt,Visual C++,Mingw,我需要将OpenCV包含到我的程序中,所以在很长时间之后,我放弃了在mingw上设置它(它对我的程序来说是完全功能的),并安装了MSVC17编译器和调试器。但当我用MSVC运行我的应用程序时,程序会因0x0000005代码而崩溃,0xfffffff上的访问冲突 它总是在main.cpp中的app.exec()上崩溃 int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiS

我需要将OpenCV包含到我的程序中,所以在很长时间之后,我放弃了在mingw上设置它(它对我的程序来说是完全功能的),并安装了MSVC17编译器和调试器。但当我用MSVC运行我的应用程序时,程序会因
0x0000005代码而崩溃,0xfffffff
上的访问冲突

它总是在main.cpp中的
app.exec()
上崩溃

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);

    MyClass myClass;
    myClass.getView()->setMinimumWidth(900);
    myClass.getView()->setMinimumHeight(600);
    QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(myClass.getView());
    quickWindow->setFlags(Qt::FramelessWindowHint);

    //Connecting signal from QML to exit application
    QObject::connect(myClass.getView()->engine(), SIGNAL(quit()), &app, SLOT(quit()));

    quickWindow->show();


    return app.exec(); //Here it crash
}
intmain(intargc,char*argv[])
{
QCoreApplication::setAttribute(Qt::AA_enableHighdDiscaling);
QGUI应用程序应用程序(argc、argv);
MyClass MyClass;
myClass.getView()->setMinimumWidth(900);
myClass.getView()->setMinimumHeight(600);
QQuickWindow*quickWindow=qobject_cast(myClass.getView());
快速窗口->设置标志(Qt::FramelessWindowHint);
//将信号从QML连接到退出应用程序
连接(myClass.getView()->engine()、信号(quit())、应用程序、插槽(quit());
快速窗口->显示();
return app.exec();//这里它崩溃了
}
正如我所说,它与mingw(32位)完全兼容

MSVC2017 x64在构建应用程序时会崩溃吗?之前,mingw x32使用过这个应用程序?有人知道怎么修吗

多谢各位

//编辑:

不知何故,它适用于发行版,但不适用于调试模式

//编辑:


只有当应用程序显示可见的QML对象时,它才会崩溃这听起来像是32位与64位的问题

尝试更新项目上的依赖项,并查看是否可以解决此问题。如果指定该CPU版本,则应该能够将原始源代码重新构建为x64,并更新所有x86版本的依赖项

或者,以32位模式运行应用程序。