【问题标题】:OpenCV 3 : Program not running in EclipseOpenCV 3:程序未在 Eclipse 中运行
【发布时间】:2016-04-12 14:53:04
【问题描述】:

我正在尝试在使用 cmake 构建的 MinGW 中的 Eclipse CDT 中运行一个简单的图像显示程序。

OpenCV 包含路径:"E:\cv\opencv\eclipse\install\include"

OpenCV 库路径:“E:\cv\opencv\eclipse\lib”(包含所有库,例如.libopencv_highgui310)

我的代码是,

#include <iostream>
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace std;
using namespace cv;

int main(int argc, const char** argv) {
    Mat img(500, 500, CV_8UC3, Scalar(100, 0, 0));
    cout << "LOL!!!" << endl;
    if (img.empty()) {
        cout << "Error: Image cannot be loaded." << endl;
        system("pause");
        return -1;
    }

    namedWindow("Image Window", CV_WINDOW_AUTOSIZE);
    imshow("Image Window", img);

    if (waitKey(10) == 27) {
        return -1;
    }

    destroyWindow("Image Window");

    return 1;
}

当我构建控制台显示的代码时,

07:19:50 **** Incremental Build of configuration Release for project opencv_cpp ****
Info: Internal Builder is used for build
g++ "-IE:\\cv\\opencv\\eclipseBuild\\install\\include" -O3 -Wall -c -fmessage-length=0 -o "src\\faceDetect.o" "..\\src\\faceDetect.cpp" 
g++ "-LE:\\cv\\opencv\\eclipseBuild\\lib" -o opencv_cpp.exe "src\\faceDetect.o" -llibopencv_highgui310 -llibopencv_core310 -llibopencv_imgproc310 -llibopencv_imgcodecs310 -llibopencv_objdetect310 

07:19:56 Build Finished (took 5s.647ms)

当我运行程序时,它只是终止并且没有任何反应。连打印语句都没有执行。

这里是问题视频的 youtube 链接,

https://youtu.be/kCrz_WPi_AI

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: c++ eclipse opencv windows-10


    【解决方案1】:

    即使我也长期面临这个问题。 我搜索了所有论坛、网站和谷歌,但我无法找到答案。

    但我突然想到关闭 Windows 防火墙和 Windows Defender,它对我有神奇的效果。你也试试,让我知道结果!

    编码愉快:)

    【讨论】:

      猜你喜欢
      • 2013-03-29
      • 2015-03-06
      • 2020-08-05
      • 2015-11-06
      • 1970-01-01
      • 2016-02-28
      • 2019-07-05
      • 2018-11-21
      • 2013-03-18
      相关资源
      最近更新 更多