C++ 无法从IDE运行VS2010 opencv项目
当我在调试模式下运行OpenCV项目时,它将以代码0退出 但这个从文件夹运行没有问题。谁能帮帮我吗 注:这似乎是VisualStudio的一个问题,因为程序在通过双击从资源管理器运行时没有任何错误C++ 无法从IDE运行VS2010 opencv项目,c++,visual-studio-2010,visual-c++,opencv,C++,Visual Studio 2010,Visual C++,Opencv,当我在调试模式下运行OpenCV项目时,它将以代码0退出 但这个从文件夹运行没有问题。谁能帮帮我吗 注:这似乎是VisualStudio的一个问题,因为程序在通过双击从资源管理器运行时没有任何错误 #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include &l
#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;
}
退出状态为0表示程序成功终止,因此您没有问题。
请参阅,例如问题不在于退出代码。问题是程序在VS2010上运行时没有按预期运行,但在使用explorer/cmd从外部运行时运行正常。程序以何种方式失败?在VS2012/OCV2.4.4中工作正常。