daviddoria / Examples

Many examples of many features of many software packages
233 stars 130 forks source link

compilation wrong #7

Open pswpswpsw opened 8 years ago

pswpswpsw commented 8 years ago

I used your cmake file: https://github.com/daviddoria/Examples/blob/master/c%2B%2B/PCL/Descriptors/PrincipalCurvaturesEstimation/CMakeLists.txt

and https://github.com/daviddoria/Examples/blob/master/c%2B%2B/PCL/Descriptors/PrincipalCurvaturesEstimation/PrincipalCurvaturesEstimation.cpp

It seems that I got error

Linking CXX executable PrincipalCurvaturesEstimation /usr/bin/ld: CMakeFiles/PrincipalCurvaturesEstimation.dir/PrincipalCurvaturesEstimation.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv' //usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: * [PrincipalCurvaturesEstimation] Error 1 make[1]: * [CMakeFiles/PrincipalCurvaturesEstimation.dir/all] Error 2 make: *\ [all] Error 2

Do you know what is going on?

pswpswpsw commented 8 years ago

I figured it out, at least on my computer, CMakeLists.txt need to add two additional library at the end.

target_link_libraries(PrincipalCurvaturesEstimation pcl_io pcl_common pcl_features pcl_search pcl_filters pcl_kdtree pcl_surface pcl_keypoints boost_thread boost_system )

pswpswpsw commented 8 years ago

I figured it out, at least on my computer, CMakeLists.txt need to add two additional library at the end. cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(PrincipalCurvaturesEstimation) find_package(PCL 1.0 REQUIRED COMPONENTS io) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) add_executable(PrincipalCurvaturesEstimation PrincipalCurvaturesEstimation.cpp) target_link_libraries(PrincipalCurvaturesEstimation pcl_io pcl_common pcl_features pcl_search pcl_filters pcl_kdtree pcl_surface pcl_keypoints boost_thread boost_system )

daviddoria commented 8 years ago

Great, I'm glad you got it to work. Would you mind editing the page to reflect the required changes?