Fixing OpenCV and Dev-C++ linking problems

October 15, 2010

I’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.



One comment

  1. Hello, can you help me with opencv 3.2.0 and dev-c++ 5.11?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: