无法从IDE运行VS2010 opencv项目

时间:2013-07-04 13:06:34

标签: c++ visual-studio-2010 visual-c++ opencv

当我在调试模式下运行OpenCV项目时,它以代码0退出。

但这从文件夹运行没有问题。有人能帮助我吗

P.S:这似乎是Visual Studio的问题,因为程序在通过双击从资源管理器运行时没有任何错误运行。

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

#include <stdio.h>
#include<fstream>
#include <iostream>

using namespace std;
using namespace cv;


int main(int argc, char** argv) {

    VideoCapture capture;
    Mat frame;

    capture.open(0);
    if (capture.isOpened()) {
       while (true) {
            capture >> frame;
            if (!frame.empty()) {
                imshow("Test", frame);
            } else {
                printf(" --(!) No captured frame -- Break!");
                break;
            }

            int c = waitKey(10);
            if ((char) c == 'c') {
                break;
            }
        }
    }
    return 0;
}

1 个答案:

答案 0 :(得分:2)

退出状态为0表示程序终止成功,因此您没有问题。 参见例如What is the difference between exit(0) and exit(1) in C?