Type undefined reference to `cv::fastFree(void*)'

c++, eclipse-cdt, opencv

Solution

Have you link correctly your library?

-lopencv_core
-lopencv_highgui
-L<opencv_library_path>

The libraries have to be specified after the source file on the compiler/linker command line. (The linker keeps track of unresolved symbols, and resolves them via later command-line arguments.)

Problem

I started the tutorial for opencv 2.4.7 on Win8, latest MinGW, and Eclipse Kepler R1, CDT. C++ Compiler includes are referencing to [path-to-opencv]\open247\build\include. in the MinGW C++ Linker I add the library path [path-to-opencv]\open247\build\x64\vc11\lib. The vc11 directory contains libraries for VisualStudio from what I've read. Is that still okay to compile them with MinGW? I added the core and highgui library for this sample (I don't think we need more than those). However, for this simple idle code below, I provoke the following compilation error. ``` #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main(){ Mat image; } ``` The error on compilation is: ``` Description Resource Path Location Type undefined reference to `cv::fastFree(void*)' FirstOpenCV line 278, external location: C:\Users\John\Documents\Software\opencv247\build\include\opencv2\core\mat.hpp C/C++ Problem ``` What's the reason for this? If I add ``` namedWindow("testWindow", 1); ``` I even get this error ``` Description Resource Path Location Type undefined reference to `cv::namedWindow(std::string const&, int)' main.cpp /FirstOpenCV/src line 23 C/C++ Problem ```

Original source