CMakeList.txt
Hey, I want to include so moveit headers in my CMakeList.txt, because when I run catkin_make this error comes up
CMkeFiles/inv_node.dir/src/inv_node.cpp.o: In function 'main':
inv_node.cpp:(.text+0x33f): undefined reference to 'rdf_loader::RDFLoader::RDFLoader(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: ld returned 1 exit status
make[2]: *** [/home/youbot/catkin_wsj/devel/lib/inv_node/inv_node] Error 1
make[1]: *** [inv_node/CMakeFiles/inv_node.dir/all] Error 2
make: *** [all] Error2
Can anyone say me what I have to writte in my CMakeList.txt that it works?
That would be grade.
Thanks.
this is a part of my code:
#include <ros/ros.h>
#include <fstream>
#include <sstream>
#include <urdf/model.h>
// MoveIt!
#include <moveit/robot_model/robot_model.h>
#include <moveit/robot_state/robot_state.h>
#include <moveit/rdf_loader/rdf_loader.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "inv_node");
ros::AsyncSpinner spinner(1);
spinner.start();
ros::NodeHandle nh;
// Convert urdf file in a string
std::ifstream u("youbot_arm.urdf");
std::stringstream su;
su << u.rdbuf();
// upload the urdf to the parameter server
nh.setParam("robot_description", su.str());
// Convert srdf file in a string
std::ifstream s("youbot.srdf");
std::stringstream ss;
ss << s.rdbuf();
// upload the srdf to the parameter server
nh.setParam("robot_description_semantic", ss.str());
// Initialize the robot model
// Objekt robot_model wird initialisiert durch Konstruktor der Klasse
rdf_loader::RDFLoader::RDFLoader robot_model(su.str(), ss.str());
ros::shutdown();
return 0;
}
my CMakeList.txt:
cmake_minimu_required(VERSION 2.8.3)
project(inv_node)
find_package(catkin REQUIRED COMPONENTS
moveit_core
roscpp
rospy
urdf
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES inv_node
CATKIN_DEPENDS moveit_core roscpp rospy urdf
DEPENDS system_lib
)
include_directories(
${catkin_INCLUDE_DIRS}
opt/hydro/include/moveit/rdf_loader/rdf_loader.h
)
add_executable(inv_node src/inv_node.cpp)
target_link_libraries(inv_node ${catkin_LIBRARIES})
add_dependencies(inv_node inv_node_gencpp)