Reputation: 215
I installed the pre-built libraries OpenCV 3.2.0 on Windows 7 following the instructions here and I am encountering errors when trying to use them in Visual Studio 2015.
The variable OPENCV_DIR
is set correctly:
C:\>echo %OPENCV_DIR%
C:\OpenCV\Build\x64\vc14
C:\>dir %OPENCV_DIR%
Le volume dans le lecteur C s'appelle OS
Le numéro de série du volume est 1234-ABCD
Répertoire de C:\OpenCV\Build\x64\vc14
27/01/2017 17:10 <REP> .
27/01/2017 17:10 <REP> ..
27/01/2017 17:11 <REP> bin
27/01/2017 17:10 <REP> lib
0 fichier(s) 0 octets
4 Rép(s) 19 236 450 304 octets libres
C:\>
And the rules for the project are like there
With the libraries specified as
opencv_calib3d320d.lib
opencv_core320d.lib
opencv_features2d320d.lib
opencv_flann320d.lib
opencv_highgui320d.lib
opencv_imgcodecs320d.lib
opencv_imgproc320d.lib
opencv_ml320d.lib
opencv_objdetect320d.lib
opencv_photo320d.lib
opencv_shape320d.lib
opencv_stitching320d.lib
opencv_superres320d.lib
opencv_ts320d.lib
opencv_video320d.lib
opencv_videoio320d.lib
opencv_videostab320d.lib
But when I try to compile the basic test project written there
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#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;
}
I get the error
1>------ Build started: Project: ImageCorrection, Configuration: Debug x64 ------
1> test.cpp
1>LINK : fatal error LNK1104: cannot open file 'opencv_calib3d320d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am really new to compilation and linking on Windows and Visual Studio (I am used to g++
on Linux) so I really have no idea of what I am doing wrong here.
I think that it might have something to do with the dynamic linking, but I do not know neither how to investigate nor how to solve it.
Ant help is most appreciated! :D
Upvotes: 1
Views: 4761
Reputation: 41765
OpenCV 3.2 prebuild binaries have just the world lib:
opencv_world320.lib
for releaseopencv_world320d.lib
for debug That's all you need to link.
Upvotes: 3