Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hint: How to create a nice Eclipse project for working on OpenCV with cmake

Dear OpenCV users,

in case you want to explore the OpenCV source code, it helps to create an eclipse project with cmake. Cmake has an eclipse target, which automatically creates a nicely structured eclipse project with sub-projects according to the cmake structure. Here are the instructions:

  1. Create a workspace folder, e.g. opencvws.
  2. Select this folder as workspace folder in eclipse using menu "file / switch workspace / other"
  3. Extract the opencv sources in a subfolder of the workspace folder, e.g. opencv-2.4.9
  4. In the workspace folder create am eclipse project folder e.g. eclipse-2.4.9. Note: the eclipse project folder must not be a subfolder of the opencv source folder, but a sibling. Both should be directly under the workspace folder.
  5. Open a terminal and cd to the eclipse project folder
  6. cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ../opencv-2.4.9
  7. Import the created eclipse project in eclipse using menu "file / import / general / existing eclipse project" and select the eclispe project folder you created in step 4.

See also http://www.vtk.org/Wiki/Eclipse_CDT4_Generator

I tested this with opencv 2.4.9, eclipse 3.8.1 and cmake 2.8.12.2 on Ubuntu 14.04 LTS.

I tested the project created this way for a day and things like jumping to definitions and the like worked well. I hope it helps!

Best regards,

Michael