Using PCL with Eclipse

This tutorial explains how to use Eclipse as an IDE to manage your PCL projects. It was tested under Ubuntu 14.04 with Eclipse Luna; do not hesitate to modify this tutorial by submitting a pull request on GitHub to add other configurations etc.


We assume you have downloaded and extracted a PCL version (either PCL trunk or a stable version) on your machine. For the example, we will use the pcl visualizer code.

Creating the eclipse project files

The files are organized like the following tree:

├── build
└── src
    ├── CMakeLists.txt
    └── pcl_visualizer_demo.cpp

Open a terminal, navigate to your project root folder and configure the project:

$ cd /path_to_my_project/build
$ cmake -G "Eclipse CDT4 - Unix Makefiles" ../src

You will see something that should look like:

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: /usr/lib/ccache/cc
-- Check for working C compiler: /usr/lib/ccache/cc   -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++   -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'eigen3'
--   found eigen3, version 3.2.0
-- Found eigen: /usr/include/eigen3
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   mpi
--   serialization
--   chrono
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- Found openni: /usr/lib/
-- checking for module 'openni2-dev'
--   package 'openni2-dev' not found
-- Found OpenNI2: /usr/lib/
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- Found libusb-1.0: /usr/include
-- checking for module 'flann'
--   found flann, version 1.8.4
-- Found Flann: /usr/lib/x86_64-linux-gnu/libflann_cpp_s.a
-- Found qhull: /usr/lib/x86_64-linux-gnu/
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- checking for module 'openni2-dev'
--   package 'openni2-dev' not found
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/local/lib/
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/local/lib/
-- looking for PCL_IO
-- Found PCL_IO: /usr/local/lib/
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/local/lib/
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/local/lib/
-- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/local/lib/
-- looking for PCL_2D
-- Found PCL_2D: /usr/local/include/pcl-1.7
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/local/lib/
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/local/include/pcl-1.7
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/local/lib/
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/local/lib/
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/local/lib/
-- looking for PCL_ML
-- Found PCL_ML: /usr/local/lib/
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/local/lib/
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/local/lib/
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/local/lib/
-- looking for PCL_PEOPLE
-- Found PCL_PEOPLE: /usr/local/lib/
-- looking for PCL_OUTOFCORE
-- Found PCL_OUTOFCORE: /usr/local/lib/
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/local/lib/
-- looking for PCL_STEREO
-- Found PCL_STEREO: /usr/local/lib/
-- looking for PCL_GPU_CONTAINERS
-- Found PCL_GPU_CONTAINERS: /usr/local/lib/
-- looking for PCL_GPU_UTILS
-- Found PCL_GPU_UTILS: /usr/local/lib/
-- looking for PCL_GPU_OCTREE
-- Found PCL_GPU_OCTREE: /usr/local/lib/
-- looking for PCL_GPU_FEATURES
-- Found PCL_GPU_FEATURES: /usr/local/lib/
-- looking for PCL_GPU_KINFU
-- Found PCL_GPU_KINFU: /usr/local/lib/
-- Found PCL_GPU_KINFU_LARGE_SCALE: /usr/local/lib/
-- Found PCL_GPU_SEGMENTATION: /usr/local/lib/
-- looking for PCL_CUDA_COMMON
-- Found PCL_CUDA_COMMON: /usr/local/include/pcl-1.7
-- looking for PCL_CUDA_FEATURES
-- Found PCL_CUDA_FEATURES: /usr/local/lib/
-- Found PCL_CUDA_SEGMENTATION: /usr/local/lib/
-- Found PCL_CUDA_SAMPLE_CONSENSUS: /usr/local/lib/
-- Found PCL: /usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;/usr/lib/;/usr/lib/;vtkCommon;vtkFiltering;vtkImaging;vtkGraphics;vtkGenericFiltering;vtkIO;vtkRendering;vtkVolumeRendering;vtkHybrid;vtkWidgets;vtkParallel;vtkInfovis;vtkGeovis;vtkViews;vtkCharts;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/lib/x86_64-linux-gnu/libflann_cpp_s.a;debug;/usr/lib/x86_64-linux-gnu/libflann_cpp_s.a;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/lib/x86_64-linux-gnu/;debug;/usr/lib/x86_64-linux-gnu/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;optimized;/usr/local/lib/;debug;/usr/local/lib/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;/usr/lib/x86_64-linux-gnu/;optimized;/usr/lib/x86_64-linux-gnu/;debug;/usr/lib/x86_64-linux-gnu/;/usr/lib/;/usr/lib/;optimized;/usr/lib/x86_64-linux-gnu/libflann_cpp_s.a;debug;/usr/lib/x86_64-linux-gnu/libflann_cpp_s.a;vtkCommon;vtkFiltering;vtkImaging;vtkGraphics;vtkGenericFiltering;vtkIO;vtkRendering;vtkVolumeRendering;vtkHybrid;vtkWidgets;vtkParallel;vtkInfovis;vtkGeovis;vtkViews;vtkCharts (Required is at least version "1.7")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dell/visualizer/build

Importing into Eclipse

  • Launch Eclipse CDT and select File > Import.

  • In the list select General > Existing Projects into Workspace and then next.

  • Browse (Select root directory) to the root folder of the project and select the build folder (in the example case, /home/dell/visualizer/build).

  • Click Finish.


The Eclipse indexer is going to parse the files in the project (and all the includes), this can take a lot of time and might crash Eclipse if it’s not configured for big projects. Take a look at the bottom right of Eclipse’s window to see the indexer status; it is advised not to do anything until the indexer has finished it’s job.

Configuring Eclipse

If Eclipse fails to open your PCL project you might need to change Eclipse configuration; here are some values that should solve all problems (but might not work on light hardware configurations):

$ sudo gedit /usr/lib/eclipse/eclipse.ini

Change the values in the last lines:


Restart Eclipse and go to Windows > Preferences, then C/C++ > Indexer > Cache Limits. Set the limits to [50% | 512 | 512].

Setting the PCL code style in Eclipse

You can find a PCL code style file for Eclipse in PCL GitHub trunk


If you want to apply the PCL style guide to all projects: Windows > Preferences > C/C++ > Code Style > Formatter

Project specific

If you want to apply the style guide only to one project: Go to Project > Properties, then select Code Style in the left field and Enable project specific settings, then Import and select where you profile file (.xml) is.

How to format the code

If you want to format the whole project use Source > Format. If you want to format only your selection use the shortcut Ctrl + Shift + F

Launching the program

To build the project, click on the build icon

  • Create a launch configuration, select the project on the left panel (left click on the project name); Run > Run Configurations...

  • Create a new C/C++ Application click on Search Project and choose the executable to be launched.

  • Go the second tab (Arguments) and enter your arguments; remember this is not a terminal and ~ won’t work to get to your home folder for example !

Run the program by clicking on the run icon


The Eclipse console doesn’t manage ANSI colours, you could use an ANSI console plugin to get rid of the “[0m” characters in the output.

Where to get more information

You can get more information about the Eclipse CDT4 Generator here.