views:

98

answers:

2

Hi,

I have a compile problem I can't figure out for OpenCV2.1 in c++.

Here is a simple test code I am trying to compile:

#include <iostream>
#include "cv.h"

using namespace std;

int main() {
    cout << "Hello World" << endl; // prints !!!Hello World!!!
    cv::Mat mtx;
    return 0;
}

I a compile error with an undefined reference as follows

**** Build of configuration Debug for project CJMVideo ****

**** Internal Builder is used for build               ****
g++ -IC:\OpenCV2.1\include\opencv -IC:\Program Files\Point Grey Research\FlyCapture2\include -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CJMVideo.o ..\src\CJMVideo.cpp
g++ -LC:\OpenCV2.1\lib -LC:\Program Files\Point Grey Research\FlyCapture2\lib64 -Xlinker --enable-auto-import -oCJMVideo.exe src\CJMVideo.o -lcxcore210 -lcv210 -lhighgui210 -lml210 -lFlyCapture2
src\CJMVideo.o:C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv::fastFree(void*)'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1438  ms.

The error is C:/OpenCV2.1/include/opencv/cxmat.hpp:378: undefined reference to `cv::fastFree(void*)'

I believe I have compiled all the libraries correctly from the above command...What is the problem?

Thanks

A: 

Even though the message suggests it has not found that symbol on the OpenCV libraries, I must point out that from the command line pasted above, it seems you are trying to link your application against 64-bit compiled libraries, as indicated by -LC:\Program Files\Point Grey Research\FlyCapture2\lib64. That means you must compile OpenCV to be 64-bit too, or compile both to be 32 bits.

You are probably missing one library. On Windows, my OpenCV projects usually adds cv210.lib cvaux210.lib cxcore210.lib cxts210.lib highgui210.lib, but I use Visual Studio 2005 most of the times.

karlphillip
A: 

I have had problems linking cv::fastfree when the OpenCV lib was built with the intel TBB parallel library, building without TBB worked

Martin Beckett