0
votes

I wish to use PCL with Eclipse on Ubuntu. Now, that's what I did this far:

a) Installed PCL with apt-get:

sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all

b) Created new project in eclipse ~/workspace/hello_pcl/

c) In above folder created src/pcd_write.cpp from this source.

d) Created following CMakeLists.txt:

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(hello_pcl)
find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})

e) Set include path /usr/include/pcl-1.7/ in project setting

My question is: What I should do now to build projects with Eclipse? Should I make the project with cmake:

cd ~/workspace/hello_pcl/build
cmake ../src
make

Or should I do something else? I'm fairly new to cmake.

I suppose I should add libraries to project setting, but didn't find on pcl page, what are names of these libraries...

EDIT:

OK, thanks to the comment I was able to create and run the hello_pcl application (I used solution from How to configure eclipse CDT for CMake), but now I have further issue. Application works, but the Eclipse code editor still underlines all PCL-dependent commands and signs them as Field [...] could not be resolved as well as includes Unresolved inclusion [...]. Strangely, #include <iostream> makrs also as unresolved. Should I include somehow PCL libraries?

1
CMake allows you to create eclipse CDT4 compatible makefiles and project files - πάντα ῥεῖ

1 Answers

1
votes

I have managed to solve my problem, this is what I have done:

Basically, point from a) to d) are correct (though I have created the project not in eclipse workspace folder, but in ~/). Now is the trick: It seems, that when following typical workflow for using CMake with Eclipse CDT, indexer behaves incorrectly. Even after adding specific include path to Path and Symbols in project properties.

What is essential here, is that after creating CMakeLists.txt (maybe for start is better to set target_link_libraries for all libraries - ${PCL_LIBRARIES}), one has to build the project with (in my case):

cd ~/hello_pcl/build
cmake -G "Eclipse CDT4 - Unix Makefiles" ../src

Of course, if You want to have Debug build, You have to specify proper option.

Next step is to add project to eclipse workspace but not as a Makefile project, but as general project, that is: File -> Import -> General -> Existing projects into workspace. Place path to the build folder in Select root directory (~/hello_pcl/build in my case) and click Finish.

This is the moment, when indexer parses all includes. And it takes a lot of time. But after that, everything seems to work fine.