1
我正在嘗試使用yaml-cpp,並且根據wiki,這是一個系統依賴項,所以我們甚至不需要更改CMakelists.txt或manifest.xml。然而,當我編譯代碼,我還是得到這樣的錯誤:錯誤在ROS中使用yaml-cpp?
/home/aramus/fuerte_workspace/sandbox/image_test/src/image_test.cpp:53: undefined reference to `YAML::Parser::Parser(std::basic_istream<char, std::char_traits<char> >&)'
/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()'
我已經添加到的CMakeLists.txt唯一的代碼是:
target_link_libraries(${PROJECT_NAME} yaml-cpp)
rosbuild_add_executable(image_test src/image_test.cpp)
我在Linux中使用富爾特。任何解決方案?編輯: 我找到了我的解決方案!我改變了我的CMakeLists.txt來構建可執行文件,然後添加yaml-cpp庫!
rosbuild_add_executable(image_test src/image_test.cpp)
target_link_libraries(image_test yaml-cpp)
我的CMakeLists.txt中的這兩行工作正常!
謝謝,我添加了一行在年底,現在可以創造奇蹟!我原來是在rosbuild_add_executable代碼之前使用它的,這讓我在很大的時間裏感到困惑。 – joshualan 2013-04-05 03:26:54