私は yaml-cpp を使用しようとしていますが、wikiによると、これはシステム依存であるため、CMakelists.txt または manifest.xml を変更する必要さえありません。ただし、コードをコンパイルすると、次のようなエラーが引き続き発生します。
/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でfuerteを使用しています。解決策はありますか?
編集:解決策を見つけました! CMakeLists.txt を変更して、最初に実行可能ファイルをビルドしてから、yaml-cpp ライブラリを追加しました。
rosbuild_add_executable(image_test src/image_test.cpp)
target_link_libraries(image_test yaml-cpp)
私の CMakeLists.txt のこれらの 2 行は正常に動作します。