Robotics StackExchange | Archived questions

Linking errors with pcl and ROS

Hello,

 I am trying to build the example in this tutorial: http://wiki.ros.org/pcl/Tutorials
 In the end, I have got the error listed bellow. It seems that I have to configure some parameters in CMakeLists.txt, but I am not sure. 

Also, to compile I have put the following sentences in CMakeLists.txt (to find the pcl include directories):

include_directories(/opt/ros/groovy/include/pcl-1.6/pcl)

include_directories(/opt/ros/groovy/include/pcl-1.6)

include_directories(/usr/include/eigen3)

Anyone can help me?

[ 0%] [ 0%] [ 0%] Built target stdmsgsgeneratemessagespy Built target stdmsgsgeneratemessagescpp Built target stdmsgsgeneratemessageslisp [ 13%] Built target beginnertutorialsgeneratemessagescpp [ 46%] Built target beginnertutorialsgeneratemessageslisp [ 53%] Built target beginnertutorialsgeneratemessagespy [ 53%] Built target beginnertutorialsgencpp [ 66%] [ 66%] Built target listener Built target controller [ 73%] Built target recog Linking CXX executable /informatik2/wtm/home/borghetti/Development/ROSTest/catkinws/devel/lib/beginnertutorials/surface [ 80%] Built target addtwointsclient [ 93%] [ 93%] Built target talker Built target addtwointsserver [ 93%] Built target beginnertutorialsgeneratemessages CMakeFiles/surface.dir/src/surface.cpp.o: In function `cloudcb(boost::sharedptr<sensormsgs::PointCloud2std::allocator<void > const> const&)': surface.cpp:(.text+0x46): undefined reference to `pcl::PCLBase<sensormsgs::PointCloud2std::allocator<void > >::setInputCloud(boost::sharedptr > const> const&)' surface.cpp:(.text+0x86): undefined reference to pcl::Filter<sensor_msgs::PointCloud2_<std::allocator<void> > >::filter(sensor_msgs::PointCloud2_<std::allocator<void> >&)' CMakeFiles/surface.dir/src/surface.cpp.o: In functionpcl::VoxelGrid > >::VoxelGrid()': surface.cpp:(.text.ZN3pcl9VoxelGridIN11sensormsgs12PointCloud2ISaIvEEEEC2Ev[ZN3pcl9VoxelGridIN11sensormsgs12PointCloud2ISaIvEEEEC5Ev]+0x25): undefined reference to vtable for pcl::VoxelGrid<sensor_msgs::PointCloud2_<std::allocator<void> > >' CMakeFiles/surface.dir/src/surface.cpp.o: In functionpcl::VoxelGrid > >::~VoxelGrid()': surface.cpp:(.text.ZN3pcl9VoxelGridIN11sensormsgs12PointCloud2ISaIvEEEED2Ev[ZN3pcl9VoxelGridIN11sensormsgs12PointCloud2ISaIvEEEED5Ev]+0x14): undefined reference to `vtable for pcl::VoxelGrid > >' collect2: ld returned 1 exit status make[2]: *** Error 1 make[1]: *** [beginner_tutorials/CMakeFiles/surface.dir/all] Error 2 make: *** [all] Error 2 Invoking "make" failed

Asked by borghetti on 2014-03-07 03:46:25 UTC

Comments

Answers

Hello,

 I have forgotten to include the following lines (as stated in tutorial) in CMakeLists.txt

find_package(PCL 1.2 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

target_link_libraries (APPLICATION ${PCL_LIBRARIES})

After this, the building problem was solved. Thanks!

Asked by borghetti on 2014-03-07 04:40:48 UTC

Comments