OpenCV3.1 VS2010 - Linker Error

asked 2018-02-09 05:28:51 -0500

Lunarix gravatar image

Hello, I have to use vs2010 and opencv3.1 for testing purpose.

I cmaked a project and build it with my visual studio. Now I'd like to write a short program to test it. Sadly it does not work when creating. this is my code:

Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file

if(! image.data ) // 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;

header:

#include "stdafx.h" #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/video/video.hpp> #include <iostream>

And the error:

opencv-test2018.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""class cv::Mat __cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@AEBVString@1@H@Z)
C:\Users\Visual Studio 2010\Projects\opencv-test2018\x64\Release\opencv-test2018.exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.'

I added the linker setting to:

C:\OpenCV-3-1-0\opencv\build\install\x64\vc10\lib

there are all the .lib inside. I added the following

opencv_calib3d310.lib
opencv_core310.lib
opencv_highgui310.lib
opencv_imgproc310.lib
opencv_video310.lib
opencv_ml310.lib

which are all located inside. I have set my VS to x64 Release

Any idea why i can not create the project?

edit retag flag offensive close merge delete