title: Catkin/Ros "undefined reference to"
body: <p>I'm trying to build a project with ROS, but I keep getting "undefined reference to &lt;>" errors, for exemple :</p>
  
  <pre><code>
  
      CMakeFiles/robot_controller_node.dir/src/Node_Robot_Controller.cpp.o: dans la fonction « main »:
      Node_Robot_Controller.cpp:(.text+0x1f1): référence indéfinie vers « trajectoryclass::trajectoryclass(ros::NodeHandle) »
      Node_Robot_Controller.cpp:(.text+0x796): référence indéfinie vers « List_Container::getElement(int) »
      Node_Robot_Controller.cpp:(.text+0x7ab): référence indéfinie vers « Task_Interface::getTaskDescription() »
      Node_Robot_Controller.cpp:(.text+0x7d1): référence indéfinie vers « List_Container::getElement(int) »
      Node_Robot_Controller.cpp:(.text+0x7d9): référence indéfinie vers « Task_Interface::getTaskId() »
      Node_Robot_Controller.cpp:(.text+0x83a): référence indéfinie vers « List_Container::getElement(int) »
      Node_Robot_Controller.cpp:(.text+0x977): référence indéfinie vers « List_Container::next() »
      Node_Robot_Controller.cpp:(.text+0xa60): référence indéfinie vers « List_Container::getElement(int) »
      Node_Robot_Controller.cpp:(.text+0xa68): référence indéfinie vers « Task_Interface::getTaskId() »
      Node_Robot_Controller.cpp:(.text+0xab5): référence indéfinie vers « List_Container::getElement(int) »
      Node_Robot_Controller.cpp:(.text+0xadd): référence indéfinie vers « List_Container::isEmpty() »
      /home/tcozic/Documents/git_ur10/catkin_ws/devel/lib/librobot_controller_library.so: référence indéfinie vers « error_norm(std::vector >, std::vector >) »
      /home/tcozic/Documents/git_ur10/catkin_ws/devel/lib/librobot_controller_library.so: référence indéfinie vers « Position_Joint::getVector() »
      collect2: error: ld returned 1 exit status
      make[2]: *** [/home/tcozic/Documents/git_ur10/catkin_ws/devel/lib/ur10/robot_controller_node] Erreur 1
      make[1]: *** [ur10/CMakeFiles/robot_controller_node.dir/all] Erreur 2
      make: *** [all] Erreur 2
      Invoking "make install -j4 -l4" failed
  
  </code></pre>
  
  <p>This is my CmakeLists.txt for the compilation of this package :</p>
  
  <pre><code>&lt;pre&gt;&lt;code&gt;
  cmake_minimum_required(VERSION 2.8.3)
  project(ur10)
  
  set(MSG_DEPS
    std_msgs
    sensor_msgs
    geometry_msgs
    trajectory_msgs
    moveit_msgs
  )
  
  
  find_package(catkin REQUIRED COMPONENTS
    message_generation
    moveit_core
    moveit_ros_planning
    moveit_ros_planning_interface
    dynamic_reconfigure
    moveit_ros_move_group
    pcl_conversions ##adding
    pcl_msgs ##adding
    roscpp
    rospy
    roslib
    #tf
    #urdf
    genmsg
   ${MSG_DEPS}
  )
  
  
  
  
  find_package(VISP REQUIRED)
  find_library(VISP_LIBRARIES NAMES visp HINTS ${VISP_LIBRARY_DIRS} )
  
  find_package(PCL REQUIRED)
  find_package(OpenCV REQUIRED)
  
  find_package( ur_package REQUIRED)
  
  ## Generate messages in the 'msg' folder
   add_message_files(
     FILES
     Task_move.msg
     Task_wait.msg
     Piece.msg
     Task.msg
     Task_tool.msg
   )
  # Generate services in the 'srv' folder
   add_service_files(
     FILES
     Validation.srv
     NewPiece.srv
   )
  
  ## Generate added messages and services with any dependencies listed here
   generate_messages(
     DEPENDENCIES
     std_msgs  # Or other packages containing msgs
   )
  catkin_package(
    INCLUDE_DIRS include
    LIBRARIES ${PROJECT_NAME}
    CATKIN_DEPENDS message_runtime roscpp rospy roslib moveit_core moveit_ros_planning_interface   #moveit_plan_execution
   moveit_trajectory_execution_manager moveit_ros_planning  moveit_planning_scene_monitor ${MSG_DEPS}
    DEPENDS VISP OpenCV
  )
  
  
  ###########
  ## Build ##
  ###########
  
  
  include(CheckCXXCompilerFlag)
  CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
  CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
  if(COMPILER_SUPPORTS_CXX11)
      set(CMAKE_CXX_FLAGS "-std=c++11")
  elseif(COMPILER_SUPPORTS_CXX0X)
      set(CMAKE_CXX_FLAGS "-std=c++0x")
  else()
      message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler. Suggested solution: update the pkg build-essential ")
  endif()
  
  
  ## Specify additional locations of header files
  ## Your package locations should be listed before other locations
  include_directories(include ${catkin_INCLUDE_DIRS})
  include_directories(${ur_package_INCLUDE_DIRS})
  
  ## Declare a C++ library
   add_library(robot_controller_library
       src/List_Container/List_Container.cpp
  
       src/Piece_Description/Piece.cpp
  
       src/Robot_Description/Robot.cpp
       src/Robot_Description/Tool.cpp
       src/Robot_Description/Tool_IO_Config.cpp
  
       src/Position/Position_Interface.cpp
       src/Position/Position_Joint.cpp
       src/Position/Position_TCP.cpp
  
       src/Task/Task_Move.cpp
       src/Task/Task_Tool.cpp
       src/Task/Task_Wait.cpp
   )
  add_dependencies(robot_controller_library ur10_gencpp)
  
  # Declare a C++ executable
  add_executable(robot_controller_node src/Node_Robot_Controller.cpp)
   #add_dependencies(robot_controller ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
   target_link_libraries(robot_controller_node  robot_controller_library ${catkin_LIBRARIES} ${VISP_LIBRARIES})
  
  
  &lt;/code&gt;&lt;/pre&gt;
  </code></pre>
  
  <p>All *.cpp files are classes, with theirs own headers in the include/ur10/ [Directory_name]/directories, except for the Node_controller_node.cpp</p>
  
  <p>This is my first big project with ROS and I don't understand where the problem come from....</p>
  
  <p>Thanks in advance for your help !</p>
  
  <p>Edit : I tried to compile the library without the node:</p>
  
  <pre> <code>
  
  
  ## Declare a C++ library
  set(SOURCE_robot_controller_library
       src/List_Container/List_Container.cpp
  
       src/Piece_Description/Piece.cpp
  
       src/Robot_Description/Robot.cpp
       src/Robot_Description/Tool.cpp
       src/Robot_Description/Tool_IO_Config.cpp
  
       src/Position/Position_Interface.cpp
       src/Position/Position_Joint.cpp
       src/Position/Position_TCP.cpp
  
       src/Task/Task_Move.cpp
       src/Task/Task_Tool.cpp
       src/Task/Task_Wait.cpp
  
  
       src/Task/Task_Interface.cpp
  
   )
  add_library(Robot_controller_lib ${SOURCE_robot_controller_library})
  add_dependencies(Robot_controller_lib ur10_gencpp)
  target_link_libraries(Robot_controller_lib
          ${catkin_LIBRARIES}
          ${VISP_LIBRARIES})
  </code></pre>
  
  <p>I don't have any errrors, but I keep getting the reference error when I try to add the compilation of the node :</p>
  
  <pre><code>
  add_executable(robot_controller_node src/Node_Robot_Controller.cpp)
  add_dependencies(robot_controller_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  target_link_libraries(robot_controller_node 
      Robot_controller_lib
      ${catkin_LIBRARIES}
          ${VISP_LIBRARIES})
  </code></pre>
  
  <p>PS: I can't post code here, it is for a professionnal project.</p>
  
  <p>Could it be a probleme with the use of inheritance or virtual functions with catkin ? The classes List_Container and Task_Interface possess virtual functions and inherit others class. I already make sure that all functions have been implemented.</p>