I am trying to compile a very simple OpenCV (2.4.9) program in Visual Studio 2010 just to check whether opencv libraries have been linked properly. Here is the program code I am trying to run.
#include "stdafx.h"
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
Mat image;
image = imread( "MyPic.jpg", 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", CV_WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
But when I press the build button, the compilation fails and shows the following error.
1>LINK : fatal error LNK1104: cannot open file 'opencv_gpu249.lib'
What the problem could be? How to solve it?
You need to add the OpenCV library path to the Visual Studio's Library Directories :
OpenCV-2.4.9-Path\build\x86\vc10\lib
or for 64bits
OpenCV-2.4.9-Path\build\x64\vc10\lib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.