Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 417

Linking CXX executable error, undefined reference to TinyXml

$
0
0
Hello everyone, I am trying to compile catkin_make on this project more than a month now that is why I am desperately putting it up to the forum, I would be very grateful if you could help me with this somehow, I downloaded a repository from github: https://github.com/philip-long/cable_driven_robot and could compile it with ROS Kinetic but since I experienced some issues in the code I asked the author in what environment was he working with it, so I installed ROS Indigo in the suitable ubuntu version and I cant compile the same code ever since. I get a message from catkin_make: Linking CXX executable /home/aron/catkin_ws/devel/lib/br_motor_driver/ros_driver [ 14%] Built target _cable_rob_generate_messages_check_deps_cable_msgs [ 14%] Built target sensor_msgs_generate_messages_cpp [ 14%] Built target std_msgs_generate_messages_cpp [ 14%] Built target geometry_msgs_generate_messages_cpp [ 14%] Built target trajectory_msgs_generate_messages_cpp /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `vtable for TiXmlDocument' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlNode::~TiXmlNode()' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlElement::QueryDoubleAttribute(char const*, double*) const' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlElement::SetAttribute(std::string const&, std::string const&)' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlDocument::Accept(TiXmlVisitor*) const' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlNode::FirstChildElement(char const*) const' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlElement::TiXmlElement(std::string const&)' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlDocument::TiXmlDocument()' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlElement::QueryBoolAttribute(char const*, bool*) const' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlNode::LinkEndChild(TiXmlNode*)' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `vtable for TiXmlPrinter' /home/aron/catkin_ws/devel/lib/libbr_robot.so: undefined reference to `TiXmlElement::TiXmlElement(char const*)' collect2: error: ld returned 1 exit status make[2]: *** [/home/aron/catkin_ws/devel/lib/br_motor_driver/ros_driver] Error 1 make[1]: *** [cable_driven_robot/br_motor_driver/CMakeFiles/ros_driver.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 14%] Built target _cable_rob_generate_messages_check_deps_robot_cables_msgs make: *** [all] Error 2 Invoking "make -j2 -l2" failed I searched a lot of forums where I followed there advice, by installing the tinyxml library again, installed aptitude and installed tinyxml as a package, still didnt work, I installed various versions of tinyxml, still no success I get the same message where it wont be able to create the executable ros_driver I checked the CmakeLists.txt file and followed this tutorial: http://wiki.ros.org/tinyxml to see if there is some error but I couldn't find any, it should work just as it works in ROS Kinetic :/ Also if I run: # apt search tinyxml Sorting... Done Full Text Search... Done libtinyxml-dev/trusty,now 2.6.2-2 amd64 [installed] TinyXml library - header and static library libtinyxml-doc/trusty 2.6.2-2 all TinyXml library - documentation files libtinyxml2-0.0.0/trusty,now 0~git20120518.1.a2ae54e-1 amd64 [installed,automatic] C++ XML parsing library libtinyxml2-2/trusty-backports 2.1.0-1~ubuntu14.04.1 amd64 C++ XML parsing library libtinyxml2-dev/trusty,now 0~git20120518.1.a2ae54e-1 amd64 [installed] TinyXML2 library - header and static library libtinyxml2.6.2/trusty,now 2.6.2-2 amd64 [installed,automatic] C++ XML parsing library libtinyxml2.6.2-dbg/trusty 2.6.2-2 amd64 TinyXml library - debug files I get the correct result I suppose, that it is intalled, although I have a feeling that ROS cant find that library anyway. I am pasting the CmakeLists file as well just in case: cmake_minimum_required(VERSION 2.8.3) project(br_motor_driver) Find catkin macros and libraries if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) is used, also find other catkin packages set(MSG_DEPS sensor_msgs ) find_package(catkin REQUIRED COMPONENTS roscpp roslib genmsg ${MSG_DEPS} cmake_modules ) find_package(TinyXML REQUIRED) catkin_package( INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME} CATKIN_DEPENDS roscpp roslib ${MSG_DEPS} DEPENDS TinyXML ) ########### ## 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) include_directories( include ${catkin_INCLUDE_DIRS} ${TinyXML_INCLUDE_DIRS} ) Add cmake target dependencies of the library as an example, code may need to be generated before libraries either from message generation or dynamic reconfigure add_dependencies(br_driver ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) add_library(br_robot src/br_robot.cpp) add_library(${PROJECT_NAME} src/ros_driver.cpp include/br_motor_driver/br_robot.h ) Declare a C++ executable add_executable(ros_driver src/ros_driver.cpp) target_link_libraries(ros_driver br_robot ${catkin_LIBRARIES} ${TinyXML_LIBRARIES}) add_executable(friction_identification src/friction_identification.cpp) target_link_libraries(friction_identification ${catkin_LIBRARIES} ) add_executable(robot_simulator src/robot_simulator.cpp) target_link_libraries(robot_simulator ${catkin_LIBRARIES} ${TinyXML_LIBRARIES})

Viewing all articles
Browse latest Browse all 417

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>