Closed Joechencc closed 4 years ago
Sorry, I fixed that, it is due to my target_link_library
add_executable(pointcloudlistener src/pointcloudlistener.cpp) target_link_libraries(pointcloudlistener ${catkin_LIBRARIES} ${LCM_LIBRARY}) add_dependencies( ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} )
Fixed
Same applies to
lcm_publish' and
lcm_destory'. Where should I add lcm to Cmake?CMakeFiles/pointcloudlistener.dir/src/pointcloudlistener.cpp.o: In function
callback(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&)': pointcloudlistener.cpp:(.text+0x93a): undefined reference to
lcm_create' pointcloudlistener.cpp:(.text+0xabc): undefined reference tolcm_publish' CMakeFiles/pointcloudlistener.dir/src/pointcloudlistener.cpp.o: In function
lcm::LCM::~LCM()': pointcloudlistener.cpp:(.text._ZN3lcm3LCMD2Ev[_ZN3lcm3LCMD5Ev]+0x91): undefined reference to `lcm_destroy' collect2: error: ld returned 1 exit status beginner_tutorials/CMakeFiles/pointcloudlistener.dir/build.make:384: recipe for target '/home/chaonew/catkin_ws/devel/lib/beginner_tutorials/pointcloudlistener' failed make[2]: [/home/chaonew/catkin_ws/devel/lib/beginner_tutorials/pointcloudlistener] Error 1 CMakeFiles/Makefile2:821: recipe for target 'beginner_tutorials/CMakeFiles/pointcloudlistener.dir/all' failed make[1]: [beginner_tutorials/CMakeFiles/pointcloudlistener.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2