Ask Your Question

Revision history [back]

VS2012 and OpenCV

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