Win7 QT opencv:程序异常退出 or 无法定位程序输入点于Qt5Creator

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/itlihongzhi/article/details/53202524

程序异常退出:

在win7下按照各种网络方法搭建好qt和opencv环境后,同样按照网络方法写一个利用opencv展示图片的小窗口展示一下,发现:出现不了页面,命令行窗口一直显示程序异常退出,在参考各位网友的做法后,总结如下:

  1. 编译完成的opencv的install目录下的lib里的bin目标加入win7系统环境变量
  2. C:\Qt\Qt5.6.1\5.6\mingw49_32\bin加到系统环境变量中去
  3. C:\Qt\Qt5.6.1\Tools\mingw492_32\bin加到系统环境变量中去
  4. C:\Qt\Qt5.6.1\Tools\mingw492_32\i686-w64-mingw32\bin加到系统环境变量中去
  5. C:\Qt\Qt5.6.1\Tools\QtCreator\bin加到系统环境变量中

无法定位程序入口Qt5Creator:

在qt的pro文件中加入:QT + = core,完整pro文件如下

QT+ = core
INCLUDEPATH+=D:\study\opencv\lib\install\include\opencv\
                    D:\study\opencv\lib\install\include\opencv2\
                    D:\study\opencv\lib\install\include
LIBS+=-L "D:\study\opencv\lib\install\x86\mingw\lib" \
        -lopencv_calib3d2412\
        -lopencv_contrib2412\
        -lopencv_core2412\
        -lopencv_features2d2412\
        -lopencv_flann2412\
        -lopencv_gpu2412\
        -lopencv_highgui2412\
        -lopencv_imgproc2412\
        -lopencv_legacy2412\
        -lopencv_ml2412\
        -lopencv_objdetect2412\
        -lopencv_video2412

SOURCES += \
    main.cpp

完整的main.cpp文件

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int main(int argc,char* argv[])
{
    //声明IplImage指针
    IplImage* pImg;
    //载入图片
    pImg=cvLoadImage("D:/study/opencv/work/naen_1.jpg",1);
    //创建窗口
    cvNamedWindow("Image",1);
    //显示图像
    cvShowImage("Image",pImg);
    //等待按键
    cvWaitKey(0);
    //销毁窗口
    cvDestroyWindow("Image");
    //释放图像
    cvReleaseImage(&pImg);

    return 0;
}




展开阅读全文

QT程序异常退出

12-23

我在window下编写的程序能够正常运行,然后把源码拿到linux下的QTCreator结果程序异常退出,win下linux都是QT5.3.2,构建是没有任何问题的,可是运行就直接异常结束了,rn报错如下:rnStarting /home/zqs/QT/build-Final-Desktop_Qt_5_4_0_GCC_64bit-Debug/Final...rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_liucheng_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_xitong_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_netconfig_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_data_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_historydata_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_alarm_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_turn_shezhi_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_true_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_1_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_2_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_3_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_4_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_5_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_6_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_7_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_8_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_9_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_0_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_dian_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_shanchu_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_clean_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_ok_clicked()rnQMetaObject::connectSlotsByName: No matching signal for on_button_close_clicked()rn程序异常结束。rn/home/zqs/QT/build-Final-Desktop_Qt_5_4_0_GCC_64bit-Debug/Final crashedrn这个报错没有任何提示,运行应该弹出我创建的窗口,可是窗口都还没有弹出就直接异常结束了 论坛

没有更多推荐了,返回首页