gpt4 book ai didi

c++ - 为 CMake 链接 Openscenegraph 库

转载 作者:行者123 更新时间:2023-11-28 01:58:13 29 4
gpt4 key购买 nike

好吧,我是 CMake 的新手,想在 eclipse 而不是 visual studio 中编辑飞行模拟代码。为此,我下载了 Simgear、CMake、Boost 库、开放场景图和 openalsoft 的源代码。

现在我拥有所有可用数据,但我不知道将其中一些库放在哪里。结果,当我运行 CMake 并引用我的 flightgear 代码时,它会提示没有安装 openscenegraph 库。

请帮助我将所有这些文件放在哪里,以便使用 CMake 将我的代码转换为 eclipse。我已经安装了 boost 和 openal 库。唯一的问题是 openscenegraph 库,我将其放入以下路径“C:\Program Files\OpenSceneGraph-3.4.0”的程序文件中,但 CMake 无法访问它。错误代码为

Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
version is 2016 dot 3 dot 1
ignoring: ^C:/Media/Project/study material/flight gear/simgear-2016.3.1/.git;\\.gitignore;Makefile.am;~$;
Library installation directory: lib
Boost version: 1.62.0
SimGear mode: NORMAL
Found OpenAL: C:/Program Files/OpenAL/OpenAL32.lib
Sound support: ENABLED
Could NOT find osgText (missing: OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)
Could NOT find osgSim (missing: OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)
Could NOT find osgDB (missing: OSGDB_LIBRARY OSGDB_INCLUDE_DIR)
Could NOT find osgParticle (missing: OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)
Could NOT find osgGA (missing: OSGGA_LIBRARY OSGGA_INCLUDE_DIR)
Could NOT find osgViewer (missing: OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)
Could NOT find osgUtil (missing: OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)
Could NOT find osg (missing: OSG_LIBRARY OSG_INCLUDE_DIR)
Could NOT find OpenThreads (missing: OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find OpenSceneGraph (missing: OPENSCENEGRAPH_LIBRARIES
OPENSCENEGRAPH_INCLUDE_DIR OSGTEXT_FOUND OSGSIM_FOUND OSGDB_FOUND
OSGPARTICLE_FOUND OSGGA_FOUND OSGVIEWER_FOUND OSGUTIL_FOUND OSG_FOUND
OPENTHREADS_FOUND) (Required is at least version "3.2.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.7/Modules/FindOpenSceneGraph.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:243 (find_package)


Configuring incomplete, errors occurred!
See also "C:/Users/shajeeh/Documents/CMake/CMakeFiles/CMakeOutput.log".

最佳答案

我不是 CMake 专家,这里是我为在 Linux 中创建 ROS 和 OSG 项目所做的一些事情:

向 .bashrc 文件添加一个环境变量(如果还没有的话):

export PATH=${PATH}: .../OpenSceneGraph-3.4.0/bin(你的绝对路径)

然后在 CMake 文件中添加:

FIND_PACKAGE(OpenSceneGraph 组件 osgSim osgUtil osgDB osgFX osgGA osgTerrain osgViewer osgText osgWidget osgManipulator osg osgShadow)

target_link_libraries(name_of_your_executable ${PROJECT_NAME} ${OPENSCENEGRAPH_LIBRARIES})

有关更多信息,请查看 CMake 文档 herehere

关于c++ - 为 CMake 链接 Openscenegraph 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40460841/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com