
Fixing OpenCV and Dev-C++ linking problems
October 15, 2010I’m trying these days OpenCV libraries and I got some annoying errors when I tried to compile. The debug window shows something like this:
g++.exe -c main.cpp -o main.o -I”lib/gcc/mingw32/3.4.2/include” -I”include/c++/3.4.2/backward” -I”include/c++/3.4.2/mingw32″ -I”include/c++/3.4.2″ -I”include” -I”C:/OpenCV/include/opencv”
In file included from C:/OpenCV/include/opencv/cxcore.hpp:2243,
from C:/OpenCV/include/opencv/cxcore.h:2123,
from C:/OpenCV/include/opencv/cv.h:58,
from main.cpp:3:
C:/OpenCV/include/opencv/cxoperations.hpp: In member function `void cv::Ptr<_Tp>::addref()’:
After searching about on the internet I’ve found the solution. Just open the file C:\OpenCV2.0\include\opencv\cxoperations.cpp and change the line 68 with this:
#if __GNUC__ >= 4 || __MINGW32__
Now it worked for me and I can compile .cpp files with OpenCV functions.