eboix
eboix

Reputation: 5133

Undefined References to OpenCV

I'm running 32-bit Windows 7 Enterprise and CodeBlocks 10.05.

I followed this tutorial to set up OpenCV 2.2 to work with CodeBlocks.

Any programs that use the C CodeBlocks API work fine - they compile, link, and run fine. However, when I try to use C++ OpenCV functions and objects, .o files are generated, but I get linking errors, such as:

undefined reference to `cv::cvtColor(cv::Mat const&, cv::Mat&, int, int)'

After some Googling, I found that this was because I didn't include enough libraries in my search directories. However, I don't know what libraries to include.

After some searching in my OpenCV folder, I found some .a files in 3rdParty/lib and added them, too. But my problem persists.

Does anyone know what libraries I have to include in order to get my program to work?

If you need more information, please tell me and I'll give it to you.

Upvotes: 3

Views: 16950

Answers (3)

Ajay Sant
Ajay Sant

Reputation: 705

I had the same problem and tried the above which did not work and I have downloaded the precompiled OpenCV.

So what worked for me was to include the following header.

include opencv2\imgproc\imgproc.hpp

Hope this helps.

Upvotes: 5

Ahx
Ahx

Reputation: 7985

If you are using eclipse

enter image description here

Of course , I assume you have already compiled the source folder with CMake. If you haven't done already refer to this video

https://www.youtube.com/watch?v=kVyVEHK4qfQ

In the first 8 min, you will learn every configuration.

Upvotes: 0

Alex
Alex

Reputation: 10126

You need to include the libopencv_imgproc library.

Upvotes: 4

Related Questions