Home > C++, OpenCV > Config opencv in EclipseC++

Config opencv in EclipseC++

To use Eclipse C++ for your opencv related project, there are two key parts in configuration.  This post give a very clear instruction.


If you do not know where your opencv files are, open the Terminal and type:

pkg-config --cflags opencv

For instance, that command gave me this output:

-I/usr/local/include/opencv -I/usr/local/include

So if you check the files under the ‘include folder’:

$ls /usr/local/include/opencv
cv.h        cvaux.hpp    cxcore.hpp    highgui.h
cv.hpp        cvwimage.h    cxeigen.hpp    ml.h
cvaux.h        cxcore.h    cxmisc.h

If you don’t know where your libraries are (or you are just psychotic and want to make sure the path is fine), type in Terminal:

pkg-config --libs opencv

My output (in case you want to check) was: .. code-block:: bash

-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann


1. Include the right path


2. Put in right liker information(search path and filenames)

If check the linker path:you may find that opencv related libs are with prefix of lib, and suffix as x.x.x.dylib

the right way to put these files into the linker librarys, you need to strip off the prefix(lib) and suffix(dylib), but you need to keep the version number is there is any.  You could include all of them or just few top ones, which really depends on your application.

$ ls /usr/local/lib
QtCore.framework            libjasper.1.0.0.dylib
QtDeclarative.framework            libjasper.1.dylib
QtDesigner.framework            libjasper.a
QtDesignerComponents.framework        libjasper.dylib
QtGui.framework                libjpeg.8.dylib
QtHelp.framework            libjpeg.a
QtMultimedia.framework            libjpeg.dylib
QtNetwork.framework            libopencv_calib3d.2.3.1.dylib
QtOpenGL.framework            libopencv_contrib.2.3.1.dylib
QtScript.framework            libopencv_core.2.3.1.dylib
QtScriptTools.framework            libopencv_features2d.2.3.1.dylib
QtSql.framework                libopencv_flann.2.3.1.dylib
QtSvg.framework                libopencv_gpu.2.3.1.dylib
QtTest.framework            libopencv_highgui.2.3.1.dylib
QtWebKit.framework            libopencv_imgproc.2.3.1.dylib
QtXml.framework                libopencv_legacy.2.3.1.dylib
QtXmlPatterns.framework            libopencv_ml.2.3.1.dylib
gcc                    libopencv_objdetect.2.3.1.dylib
libQtCLucene.4.8.1.dylib        libopencv_ts.2.3.1.dylib
libQtCLucene.4.8.dylib            libopencv_video.2.3.1.dylib
libQtCLucene.4.dylib            libtbb.dylib
libQtCLucene.dylib            libtbbmalloc.dylib
libQtCLucene.prl            libtiff.3.dylib
libQtUiTools.a                libtiff.a
libQtUiTools.prl            libtiff.dylib
libQtUiTools_debug.a            libtiffxx.3.dylib
libQtUiTools_debug.prl            libtiffxx.a
libfrtbegin.a                libtiffxx.dylib
libg2c.0.0.0.dylib            node
libg2c.0.dylib                node_modules
libg2c.a                phonon.framework
libg2c.dylib                pkgconfig
libg2c.la                python2.7



Categories: C++, OpenCV
  1. No comments yet.
  1. No trackbacks yet.

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: