我一直在使用openCv,但刚搬到了Windows 10。
现在,现有的应用程序将编译,但我无法创建新的。
在一个新项目中(visual studio 2015,第64版)
我正在添加所有的库:
opencv_calib3d310.lib
opencv_core310.lib
opencv_features2d310.lib
opencv_flann310.lib
opencv_highgui310.lib
opencv_imgcodecs310.lib
opencv_imgproc310.lib
opencv_ml310.lib
opencv_objdetect310.lib
opencv_photo310.lib
opencv_shape310.lib
opencv_stitching310.lib
opencv_superres310.lib
opencv_ts310.lib
opencv_video310.lib
opencv_videoio310.lib
opencv_videostab310.lib
设定:
D:\opencv-master\build64\lib\Release;%(AdditionalLibraryDirectories)
和
D:\opencv-master\modules\highgui\include
D:\opencv-master\modules\imgcodecs\include
D:\opencv-master\modules\core\include
D:\opencv-master\modules\videoio\include
D:\opencv-master\modules\imgproc\include
%(AdditionalIncludeDirectories)
并添加最基本的:
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include "stdafx.h"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if (argc != 2)
{
cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file
if (image.empty()) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
在视觉工作室,Intellisense很好,没有红色下划线,一切看起来都很好。当我尝试编译时...
'cv': a namespace with this name does not exist
'Mat': undeclared identifier
'image': undeclared identifier
......还有更多。它就像它找不到libs,但我正确地连接它们,我很确定。
有人可以在这帮助我吗?