Я пытаюсь скомпилировать проект ROS OSG здесь https://github.com/uji-ros-pkg/visualization_osg и продолжать получать следующее сообщение об ошибке:неопределенная ссылка OpenSceneGraph
CMakeFiles/osg_interactive_markers_demo.dir/examples/osg_interactive_markers_demo.cpp.o: In function `main':
/home/user/catkin_ws/src/visualization_osg/osg_interactive_markers/examples/osg_interactive_markers_demo.cpp:28: undefined reference to `osgViewer::View::addEventHandler(osgGA::EventHandler*)'
/home/user/catkin_ws/src/visualization_osg/osg_interactive_markers/examples/osg_interactive_markers_demo.cpp:29: undefined reference to `osgViewer::View::addEventHandler(osgGA::EventHandler*)'
/home/user/catkin_ws/devel/lib/libosg_utils.so: undefined reference to `osg::NodeVisitor::NodeVisitor(osg::NodeVisitor const&, osg::CopyOp const&)'
/home/user/catkin_ws/devel/lib/libosg_interactive_markers.so: undefined reference to `osg::Group::removeChild(osg::Node*)'
/home/user/catkin_ws/devel/lib/libosg_utils.so: undefined reference to `osg::NodeVisitor::apply(osg::Geometry&)'
/home/user/catkin_ws/devel/lib/libosg_interactive_markers.so: undefined reference to `osg::Group::getNumChildren() const'
/home/user/catkin_ws/devel/lib/libosg_utils.so: undefined reference to `osg::NodeVisitor::apply(osg::Drawable&)'
Как я понимаю, должно быть проблемой ссылки, но я не мог найти способ Исправить это. Мой файл CMake выглядит следующим образом:
cmake_minimum_required(VERSION 2.8.3)
project(osg_interactive_markers)
find_package(catkin REQUIRED COMPONENTS roscpp tf interactive_markers)
find_package(osg_utils REQUIRED)
find_package(osg_markers REQUIRED)
find_package(OpenSceneGraph REQUIRED COMPONENTS osgSim osgUtil osgDB osgFX osgGA osgTerrain osgViewer osgText osgWidget osgManipulator osg)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS
roscpp
tf
interactive_markers
DEPENDS
osg_markers
osg_utils
libopenscenegraph
)
include_directories(include ${catkin_INCLUDE_DIRS} ${osg_utils_INCLUDE_DIRS} ${osg_markers_INCLUDE_DIRS} ${OpenSceneGraph_INCLUDE_DIRS})
add_library(${PROJECT_NAME}
src/interactive_marker_client.cpp
src/interactive_marker_display.cpp
src/interactive_marker.cpp
src/interactive_marker_control.cpp
src/draggers.cpp
)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES} ${OSGUTILS_LIBRARIES} ${OSGMARKERS_LIBRARIES} -lGLU)
add_executable(osg_interactive_markers_demo examples/osg_interactive_markers_demo.cpp)
target_link_libraries(osg_interactive_markers_demo ${PROJECT_NAME} ${catkin_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES} ${OSGUTILS_LIBRARIES} ${OSGMARKERS_LIBRARIES} -lGLU)
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
configure_file(osgInteractiveMarkersConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/lib/${CMAKE_PROJECT_NAME}Config.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/${CMAKE_PROJECT_NAME}Config.cmake
DESTINATION share/${CMAKE_PROJECT_NAME})
install(
TARGETS
osg_interactive_markers_demo
${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
Любые идеи, что можно сделать здесь? Я новичок в OSG, и я очень ценю вашу помощь.
Спасибо за ваш ответ @rickyviking! Я использую FindOpenSceneGraph.cmake [link] (https://cmake.org/cmake/help/v3.0/module/FindOpenSceneGraph.html), в соответствии с этим нормально использовать OPENSCENEGRAPH_LIBRARIES – Etimr