ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Errors Using yaml-cpp Library in ROS

asked 2013-04-04 16:32:01 -0500

joshualan gravatar image

updated 2013-04-05 09:34:31 -0500

Hi guys, I'm using ROS Fuerte and trying to use yaml parsing in my program. I have a "include <yaml-cpp yaml.h="">" in my code but I am still getting errors. According to the ROS wiki, I should not need to change my CMakelists.txt or manifest.xml to use it but I still get errors like :

/home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:54: undefined reference to YAML::Node::Node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Node::~Node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Parser::~Parser()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Node::~Node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Parser::~Parser()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Node::~Node()' /home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:92: undefined reference to YAML::Parser::~Parser()'

Any help on how to fix this would be great. Thanks!

EDIT: I fixed it by adding rosbuild_add_executable(image_test src/image_test.cpp) target_link_library(${PROJECT_NAME} yaml-cpp)

I originally had the two switched around but order matters a lot!

edit retag flag offensive close merge delete

Comments

Please include your CMakeLists.txt file and manifest.txt .

Eric Perko gravatar image Eric Perko  ( 2013-04-05 08:24:17 -0500 )edit

Can you include the ROS wiki link that specified that you shouldn't need to change your CMakeLists.txt or manifest.xml to use yaml-cpp?

Eric Perko gravatar image Eric Perko  ( 2013-04-05 08:30:09 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
5

answered 2013-04-05 08:29:34 -0500

Eric Perko gravatar image

It looks like you didn't link your node against the yaml-cpp library. See the documentation for how to do that in Electric and newer.

In a nutshell you probably need to add something like: target_link_libraries(image_test yaml-cpp) to your CMakeLists.txt .

edit flag offensive delete link more
1

answered 2013-04-05 03:35:44 -0500

joq gravatar image

You don't provide much code for diagnosing this problem.

The correct header reference should be:

#include <yaml-cpp/yaml.h>

Your manifest.xml should include:

  <rosdep name="yaml-cpp"/>

Check those for a start.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-04 16:32:01 -0500

Seen: 3,919 times

Last updated: Apr 05 '13