Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unresolved external with catkin, compilation with make succed

I am trying to compile a ros library under catkin. My library, ConversionPcl.cpp, use
pcl_ros::transformPointCloud(std::string, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, tf::TransformListener)

Compiling with catkin I have undefine reference to pcl_ros::transformPointCloud(). The find_package session in the CMakeFiles.txt look as follow:

find_package(PCL 1.7 REQUIRED)
find_package(catkin REQUIRED 
COMPONENTS   pcl_conversions dynamic_reconfigure  roscpp tf rospy geometry_msgs interactive_markers pcl_ros )

and I added the build and run dependencies in this way:

<build_depend>pcl_conversions</build_depend>  
<build_depend>pcl_ros</build_depend> 
<build_depend>libpcl-all-dev</build_depend>

<run_depend>pcl_conversions</run_depend>                            
<run_depend>pcl_ros</run_depend> 
<run_depend>libpcl-all</run_depend>

I tried to compile using make and it succed. The CMakeFIle is defined as follow:

CFLAGS=-fPIC -I../include $(shell pkg-config --cflags pcl_conversions)
CXXFLAGS=$(CFLAGS)
LDLIBS=-lstdc++ $(shell pkg-config --libs pcl_conversions)

libpclconversions.so: ConversionPcl.o
$(CC) $(LDLIBS) -shared $? -o $@

clean:
rm -f *.o libpclconversions.so

Is it a catkin bug or I am doing something wrong???

unresolved external with catkin, compilation with make succed

I am trying to compile a ros library under catkin. My library, ConversionPcl.cpp, use
pcl_ros::transformPointCloud(std::string, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, tf::TransformListener)

Compiling with catkin I have undefine reference to pcl_ros::transformPointCloud(). The find_package session in the CMakeFiles.txt look as follow:

find_package(PCL 1.7 REQUIRED)
project(path_planner)


find_package(catkin REQUIRED 
COMPONENTS   pcl_conversions dynamic_reconfigure  roscpp tf rospy geometry_msgs interactive_markers pcl_ros 
)

find_package(PCL 1.7 REQUIRED)

generate_dynamic_reconfigure_options(cfg/DynamicJoinPcl.cfg
                 cfg/NormalEstimationPcl.cfg    
                 cfg/TravAnal.cfg 
                 cfg/ClusterPcl.cfg)

 catkin_package(
     INCLUDE_DIRS include
     LIBRARIES ${PROJECT_NAME} 
     CATKIN_DEPENDS 
       pcl_conversions                      
       geometry_msgs 
       roscpp 
       rospy 
       tf 
       std_msgs
       interactive_markers
       pcl_ros

          DEPENDS system_lib 
      )

      include_directories(include ${catkin_INCLUDE_DIRS}  )

      add_library(normalestimation src/NormalEstimationPcl.cpp)
      add_library(dynamicjoinpcl src/DynamicJoinPcl.cpp)
      add_library(clusterpcl src/ClusterPcl.cpp)
      add_library(conversionpcl src/ConversionPcl.cpp)
      add_library(travanalpcl src/TravAnal.cpp)
      add_library(pathplanning src/PathPlanning.cpp)
      add_library(marker src/MarkerController.cpp)

       add_executable(mapping src/mapping.cpp)
      add_executable(traversability src/traversability.cpp)
       add_executable(pathPlanner src/pathPlanner.cpp)

       target_link_libraries(mapping dynamicjoinpcl  conversionpcl normalestimation  ${catkin_LIBRARIES} ${PCL_COMMON_LIBRARIES})
       target_link_libraries(traversability clusterpcl  conversionpcl travanalpcl  ${catkin_LIBRARIES}     ${PCL_COMMON_LIBRARIES})
    target_link_libraries(pathPlanner marker  pathplanning   ${catkin_LIBRARIES}  ${PCL_COMMON_LIBRARIES})

    add_dependencies(pathPlanner ${PROJECT_NAME}_gencfg)
    add_dependencies(mapping ${PROJECT_NAME}_gencfg)
    add_dependencies(traversability ${PROJECT_NAME}_gencfg)

    install(TARGETS pathPlanner
      ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
      LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
      RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
   )

     install(TARGETS traversability
     ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
     LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
     RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)


       install(FILES
   launch/test.launch
   launch/test.yaml   
    DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
 )

and I added the build and run dependencies in this way:

<build_depend>pcl_conversions</build_depend>  
<build_depend>pcl_ros</build_depend> 
<build_depend>libpcl-all-dev</build_depend>

<run_depend>pcl_conversions</run_depend>                            
<run_depend>pcl_ros</run_depend> 
<run_depend>libpcl-all</run_depend>

I tried to compile using make and it succed. The CMakeFIle is defined as follow:

CFLAGS=-fPIC -I../include $(shell pkg-config --cflags pcl_conversions)
CXXFLAGS=$(CFLAGS)
LDLIBS=-lstdc++ $(shell pkg-config --libs pcl_conversions)

libpclconversions.so: ConversionPcl.o
$(CC) $(LDLIBS) -shared $? -o $@

clean:
rm -f *.o libpclconversions.so

Is it a catkin bug or I am doing something wrong???