我正在尝试从此处https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters编译ROS OSG项目,并不断收到以下错误:
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的新手,非常感谢你的帮助。
答案 0 :(得分:1)
问题解决了,原因是错误(双重)安装了OSG
答案 1 :(得分:0)
您未定位正确的OSG链接库。
我无法对您提到的具体github项目发表评论,但一般情况下,如果您使用osg发行版附带的FindOSG.cmake模块,则应使用
调用它。FIND_PACKAGE(OSG REQUIRED)
然后链接特定的osg库,如
OSG_LIBRARY
OSGUTIL_LIBRARY
OSGGA_LIBRARY
etc...
没有"全球"已定义OPENSCENEGRAPH_LIBRARIES符号,请参阅FindOSG.cmake