Unable to link some PCL filters (specifically PlaneClipper3D)
Dear ROS community,
I am tearing my hair out at this!
I would like to use PCL's PlaneClipper3D
in my project. At first sight it looks like a common linker error:
/home/[username]/catkin_ws/devel/lib/libmy_package.so: undefined reference to `pcl::PlaneClipper3D<pcl::PointXYZ>::~PlaneClipper3D()'
/home/[username]/catkin_ws/devel/lib/libmy_package.so: undefined reference to `pcl::PlaneClipper3D<pcl::PointXYZ>::PlaneClipper3D(Eigen::Matrix<float, 4, 1, 0, 4, 1> const&)'
I spent half a day now to figure out the correct setup of my CMakeLists.txt
and package.xml
- but no luck.
Now I did a simple sanity check and used Clipper3D
instead of PlaneClipper3D
. Now unexpectedly this works!
Can anyone explain why one filter can be used in ROS and the other one can not?
For completeness: here is my CMakeLists.txt
file:
cmake_minimum_required(VERSION 2.8.3)
project(my_package)
find_package(catkin REQUIRED COMPONENTS
pcl_conversions
pcl_ros
roscpp
sensor_msgs
)
find_package(PCL REQUIRED)
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
catkin_package(
INCLUDE_DIRS include
LIBRARIES my_package
CATKIN_DEPENDS pcl_conversions pcl_ros roscpp sensor_msgs
DEPENDS PCL
)
set(CMAKE_BUILD_TYPE Release)
add_definitions(-std=c++11 -O3)
include_directories(
include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
add_library(my_package
src/src1.cc
src/src2.cc
)
target_link_libraries(my_package ${catkin_LIBRARIES} ${PCL_LIBRARIES})
add_executable(main
src/main.cc
)
target_link_libraries(main my_package)
and my package.xml
:
<?xml version="1.0"?>
<package>
<name>my_package</name>
<version>0.0.0</version>
<description>The my_package package</description>
<maintainer email="otim@todo.todo">otim</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<!--build_depend>libpcl-all-dev</build_depend--><!-- tried with and without -->
<build_depend>pcl_conversions</build_depend>
<build_depend>pcl_ros</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<!--run_depend>libpcl-all</run_depend-->
<run_depend>pcl_conversions</run_depend>
<run_depend>pcl_ros</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
</package>
Update: I am using standard ROS indigo on Ubuntu 14.04 64bit. PCL was installed along with the ROS installation precedure not from source. PCL version is 1.7 as far as I know.
ROS version, PCL version, OS, OS version, from source / debs, etc.
Updated...