請看看下面的代碼只輸出 「退出,代碼爲0」
的main.cpp
#include <QCoreApplication>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
Mat image = imread("C:/Users/Public/Pictures/Sample Pictures/Tulips.jpg");
namedWindow("Image");
imshow("Image",image);
waitKey(0);
}
Test.pro
#-------------------------------------------------
#
# Project created by QtCreator 2013-05-07T10:38:38
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = Test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += E:/Jasmin/Yohan/opencv/build/include
INCLUDEPATH += E:/Jasmin/Yohan/opencv/include/opencv2
LIBS += E:/Jasmin/Yohan/opencv/build/x86/mingw/lib/libopencv_calib3d240.dll.a
LIBS += E:/Jasmin/Yohan/opencv/build/x86/mingw/lib/libopencv_contrib240.dll.a
LIBS += E:/Jasmin/Yohan/opencv/build/x86/mingw/lib/libopencv_core240.dll.a
LIBS += E:/Jasmin/Yohan/opencv/build/x86/mingw/lib/libopencv_highgui240.dll.a
LIBS += E:/Jasmin/Yohan/opencv/build/x86/mingw/lib/libopencv_imgproc240.dll.a
當我運行這個代碼,沒有圖像顯示出來,下面的輸出得到打印
Starting E:\Jasmin\Yohan\QTProjects\build-Test-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\Test...
E:\Jasmin\Yohan\QTProjects\build-Test-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\Test exited with code 0
繼OpenCV的相關的環境變量將被添加到「路徑」系統變量
E:\Jasmin\Yohan\opencv\build\x86\mingw\bin;E:\Jasmin\Yohan\opencv\build\x86\vc10\bin
請幫幫忙!爲什麼我得到這個問題?我的Qt Creator的版本是2.7.0
UPDATE
這是我的調試器說
我不知道,但我想補充'的std ::法院<<「到這裏\ n」;'在你的代碼的不同點,看到它得到。 – john 2013-05-07 06:58:05
你的調試器說什麼? – cmannett85 2013-05-07 06:58:15
@ cmannett85:請看看更新 – 2013-05-07 07:06:52