opencv 3.1.0 unresolved external [closed]

asked 2016-02-14 07:34:24 -0600

RustC gravatar image

I just installed the opencv 3.1.0 version on my Win PC and tried to run it with Visual Studio 2010. When I compile my first bit of code I get 2 linker errors:

"unresolved externel void__cdecl cv::fastFree(void *)" 
"public: void__thiscall cv::Mat::deallocate(void).

My main code:

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include <opencv\cv.h>
#include "opencv/highgui.h"
#include "opencv2/core/mat.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main (int argc, const char * argv[])
{
 printf("Hello world, cv version: %s", CV_VERSION);
 Mat img; // = imread("TD.img", CV_LOAD_IMAGE_UNCHANGED);
 return 0;
}

The word "Mat" is not highlighted as it should be. Without the Mat line the program works fine.

Because the program compiles I think I got the include pathes right and the compiler doesnt complain about the *.libs, so they are found. I have linked the opencv_world310.lib.

What have I missed to get the things right? Thank you in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-07 12:57:42.741576

Comments

please include opencv2/opencv.hpp , the old cv.h c--api headers won't help you.

berak gravatar imageberak ( 2016-02-14 07:52:59 -0600 )edit

I did this but it wont help.

RustC gravatar imageRustC ( 2016-02-14 08:01:03 -0600 )edit

ofc, that won't help with the "unresolved external" , which is a linker problem.

are you sure, you link the correct opencv_world310.lib ? from the vc10 folder ? x86 vs.x64 ?

berak gravatar imageberak ( 2016-02-14 08:11:02 -0600 )edit

My lib path is: opencv/build/x64/vc12/lib. There is no x86 folder in my installation and no vc10 folder too. Just x64/vc12 and x64/vc14

RustC gravatar imageRustC ( 2016-02-14 08:26:39 -0600 )edit

"and no vc10 folder" - unfortunately, that means, that you will have to build the opencv libs for vs2010 from src, using cmake.

berak gravatar imageberak ( 2016-02-14 08:45:40 -0600 )edit

Oh, nooooo.... Or I update my VS to 2012.

RustC gravatar imageRustC ( 2016-02-14 09:08:53 -0600 )edit

yes, or that.

but really , in the long run you'll have to get used to building from src anyway.

berak gravatar imageberak ( 2016-02-14 09:42:54 -0600 )edit
1

Two things with Opencv 3.1.0, there are no 32bit prebuild libraries and libraries for 64bit are for VS15 and VS13. if you need other options than those, you need to build them yourselve. As it is a lil bit complicated, you might as well end up with Opencv 3.0.0

Croolman gravatar imageCroolman ( 2016-02-14 13:27:31 -0600 )edit