gpt4 book ai didi

c++ - CMake 找不到 SDL2

转载 作者:行者123 更新时间:2023-12-02 13:12:28 24 4
gpt4 key购买 nike

我要添加this library到我的项目。但是,它不附带预编译文件。它要求我自己用我不熟悉的cmake构建库。它的依赖项之一是 SDL2。所以我下载了 sdl2 开发库文件夹。在 cmake 中,我单击“配置”并选择生成器。处理几秒钟后,弹出一个窗口,显示错误:配置过程项目文件中的错误可能无效

这是日志屏幕显示的内容:

The C compiler identification is MSVC 18.0.40629.0
The CXXcompiler identification is MSVC 18.0.40629.0
Check for working Ccompiler using: Visual Studio 12 2013
Check for working C compilerusing: Visual Studio 12 2013 -- works
Detecting C compiler ABIinfo
Detecting C compiler ABI info - done
Check for workingCXX compiler using: Visual Studio 12 2013
Check for working CXXcompiler using: Visual Studio 12 2013 -- works
Detecting CXXcompiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features -done
CMake Error at C:/Program Files(x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148(message): Could NOT find SDL2 (missing: SDL2_INCLUDE_DIRSDL2_LIBRARY)
Call Stack (most recent call first):

C:/Program Files(x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388(_FPHSA_FAILURE_MESSAGE) cmake/FindSDL2.cmake:18(FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:30 (FIND_PACKAGE)

Configuring incomplete, errors occurred!
See also "E:/gamedev/libraries/libSDL2pp-master/build/CMakeFiles/CMakeOutput.log".

谁能告诉我该怎么做?我不确定我做的事情是否正确。

最佳答案

cmake 默认没有提供查找 sdl2 的模块。这很可能就是您在 cmake/FindSDL2.cmake 中提供自己的原因。当您在 Windows 上时,很可能您必须设置一个环境变量以指向 sdl2 安装目录(但这实际上取决于您使用的 FindSDL2.cmake)。

关于c++ - CMake 找不到 SDL2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34705313/

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