First time here? Check out the FAQ!


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 Apr 4 '13

joshualan gravatar image

updated Apr 5 '13

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!

Preview: (hide)

Comments

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

Eric Perko gravatar image Eric Perko  ( Apr 5 '13 )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  ( Apr 5 '13 )edit

2 Answers

Sort by » oldest newest most voted
5

answered Apr 5 '13

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 .

Preview: (hide)
1

answered Apr 5 '13

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.

Preview: (hide)

Question Tools

Stats

Asked: Apr 4 '13

Seen: 4,132 times

Last updated: Apr 05 '13