Here is a great tutorial about using PCL in cmake!
I use ROS indigo and I have no idea that it has its own PCL. So I blindly install another standalone PCL library. However, when I cmake the project, it gives me this error
undefined reference to pcl::PCDWriter
From this stackoverflow thread, it means we have to link libpcl_io.so in cmake. These are the changes I make
find_package(PCL REQUIRED)
change to
find_package(PCL REQUIRED COMPONENTS io)
and
target_link_libraries(img2pc ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARY_DIRS})
to
target_link_libraries(img2pc ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARY_DIRS} ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})
I also add add_definitions(${PCL_DEFINITIONS}) in the end
The cmake could compile after making these changes.
Another thing to note when using eigen is that, there is no need to include it in cmake even if you call it in your code, ie #include <opencv2/core/eigen.hpp>
what we have to do according to this is to use #include <Eigen/Dense> at the beginning.
No comments:
Post a Comment