Ask Your Question
0

VS2012 and OpenCV

asked 2014-03-29 13:15:22 -0500

rys gravatar image

I found a few similar questions but could not find an answer: I simply try to setup OpenCV on my machine and I wrote the following x64 program where the only opencv-related statement is “Mat image”

include <opencv2\opencv.hpp>

include <iostream>

using namespace cv; using namespace std;

int main( int argc, char** argv ) {

Mat image;

cout << "Start" << endl;

}

But I keep getting the following linker errors:

1>------ Rebuild All started: Project: enhancedLeeFilter, Configuration: Debug Win32 ------ 1> mainELEE.cpp 1>mainELEE.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) 1>mainELEE.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ) 1>mainELEE.obj : error LNK2019: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YAHPAHH@Z) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)

I have Visual Studio 2012 Ultimate installed on a Windows 7, 64 bit machine I installed x64 pre-built libraries of OpenCV 2.4.8. I followed the instructions and set the ENV variable OPENCV_DIR to be: c:\opencv\build\x64\vc11

Inside VS2012 Project properties I set: Properties->VC++ Directories->Include Directories: $(OPENCV_DIR)....\include

Properties->Linker->General->Additional Library Directories: 
$(OPENCV_DIR)\lib; $(OPENCV_DIR)\staticlib

Properties->Linker->Input->Additional Dependencies:
pencv_core248d.lib
opencv_core248.lib
opencv_imgproc248d.lib

opencv_highgui248d.lib opencv_ml248d.lib opencv_video248d.lib opencv_features2d248d.lib opencv_calib3d248d.lib opencv_objdetect248d.lib opencv_contrib248d.lib opencv_legacy248d.lib opencv_flann248d.lib

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-03-29 21:10:55 -0500

Properties->Linker->General->Additional Library Directories: Allows users to override /LIBPATH environment variable. I think the right place to add library directories is: Properties->VC++ directories->Library directories this change the env variable /LIB.

edit flag offensive delete link more

Comments

1

I tried all options and combinations and still cannot make it work. Can you think of anything else? I am out of ideas.

rys gravatar imagerys ( 2014-03-30 07:20:40 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-03-29 13:15:22 -0500

Seen: 334 times

Last updated: Mar 29 '14