Ask Your Question
0

VS2012 and OpenCV setup

asked 2014-03-29 13:07:43 -0600

rys gravatar image

updated 2014-04-25 03:28:25 -0600

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:
opencv_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

2 answers

Sort by » oldest newest most voted
1

answered 2014-04-25 03:32:41 -0600

Your problem is quite simple. Your environment is configured as 32 bit debug, while you are linking against 64 bit debug dlls. This is impossible!

Look here:

Configuration: Debug Win32

And here:

a Windows 7, 64 bit machine I installed x64 pre-built libraries of OpenCV 2.4.8

To see what you are doing wrong ...

To solve it, simply open your project, go to project properties and set your compiling platform to x64 bit!

edit flag offensive delete link more
0

answered 2014-04-25 10:18:07 -0600

You need to change the debug, or change the libraries of opencv for x86.

edit flag offensive delete link more

Comments

-1 seriously ... read my answer...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-25 15:20:55 -0600 )edit

Question Tools

Stats

Asked: 2014-03-29 13:07:43 -0600

Seen: 1,213 times

Last updated: Apr 25 '14