先貼代碼(非常簡單的代碼)
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/objdetect.hpp"
#include <iostream>
#include <time.h>
using namespace cv;
using namespace cv::ml;
using namespace std;
int main()
{
vector<String> fn;
String s = "E:/c++code/data/train_image/test/*.png";
vector<Mat> images;
size_t count = fn.size(); //number of png files in images folder
for (size_t i = 0; i<count; i++)
images.push_back(imread(fn[i]));
waitKey(0);
return 0;
}
試了各種辦法包括将String的應用。包的導入等等都不可以。弄了一天都行,都是下邊這個錯誤

研究了一天,一直以為是代碼的問題。最後的最後試一下Release模式。結果運作通了。我醉了。。。。。。
索性就對Debug和Release做了一個小小的查詢。