Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 2.4.10 + eclipse LUNA + mingw 4.8.1-4 + windows 7 x64 Installation/Referencing Problem

Hello everyone!

First of all excuse my bad english.

I'm trying to get above setting to work for almost 3 days now. I tried different installation manuals, configurations and heaps of tips and tricks. But still, I can't get it to work. I will always get some eclipse g++ error like: "wrong reference", although I DID put the OpenCV and MinGW paths to the PATH variable path. I added the libraries search path, the libraries I wanted to use to the specified preferences tab for my eclipse project.

The following is what I did in more detail:

I am using a Windows 7 64 bit machine.

OpenCV 2.4.10 Installation path: C:\opencv MinGW with g++ compiler version 4.8.1-4 installation path: C:\MinGW eclipse LUNA was downloaded and decompressed to C:\eclipse (workspace in here, too)

system PATH-variable: ... C:\MinGW\bin; C:\opencv\build\x86\vc12\bin;

I started eclipse with a C++ hello world project using the MinGW gcc toolchain. After that I right clicked my new project, clicked "properties" and opened C/C++ "Settings" tab. Then I clicked the GCC G++ Compiler "Includes" section and added "C:\opencv\build\include" path to the "Include paths" tab.

After that I clicked the MinGW C++ Linker "Libraries" tab and added "C:\opencv\build\x64\vc12\lib" to the "library search path" and all libraries I knew to the "Libraries" window like this:

opencv_calib3d2410
opencv_contrib2410
opencv_core2410
opencv_features2d2410
opencv_flann2410
opencv_gpu2410
opencv_highgui2410
opencv_imgproc2410
opencv_legacy2410
opencv_ml2410
opencv_nonfree2410
opencv_objdetect2410
opencv_photo2410
opencv_stitching2410
opencv_video2410
opencv_videostab2410

Then I tried the standard eclipse hello world program and verified it was working.

After that I wanted to try some tutorial-code I found here: http://nenadbulatovic.blogspot.sk/2013/07/configuring-opencv-245-eclipse-cdt-juno.html

//////START CODE///////////////////////////////////////////////
The code is this:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{
Mat img = imread("c:/lenna.png", CV_LOAD_IMAGE_COLOR);

namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
imshow("MyWindow", img);

waitKey(0);
return 0;
}
//////END CODE////////////////////////////////////////////////////////////////

After building this code eclipse respectively gcc showed me 7 errors:

undefined reference to `cv::imread(std::string const&, int)'
undefined reference to `cv::namedWindow(std::string const&, int)'
undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
undefined reference to `cv::waitKey(int)'
undefined reference to `cv::fastFree(void*)'
undefined reference to `cv::Mat::deallocate()'

So, as I'm quite sure it has something to do with the library settings, I still cannot figure out what.

Like I said, I found a couple of tutorials supposed to describe the setting up of an "eclipse-mingw-opencv-windows7" installation, but they all use a different version of eclipse or opencv or both, or they just give clues about unix installations. Official OpenCV-Website is down and the sourceforge.net website doesn't supply any OpenCV version between 2.3.1 to 2.4.9. I tried OpenCv version 2.2, 2.4.9 and 2.4.10.

I will be thankful for any help on this as I can imagine how annoying supporting such problems must be! ;)

Regards MrSALSA