gpt4 book ai didi

c++ - CMake 64位和SFML 64位

转载 作者:行者123 更新时间:2023-12-01 14:58:55 29 4
gpt4 key购买 nike

我正在尝试使用适用于Windows的CMake 64位和SFML 2.5.1 64位构建C++项目。当我在项目上运行cmake时,我收到一条错误消息。

使它正常工作的唯一方法是将CMAKE_PREFIX_PATH更改为指向SFML的32位版本,但这不是我想要的。

CMakeLists.txt:

cmake_minimum_required (VERSION 3.8)

#project(GameOfLife)

set(CMAKE_PREFIX_PATH "D:\\Program Files\\SFML-2.5.1\\lib\\cmake\\SFML")

find_package(SFML 2.5 COMPONENTS graphics window REQUIRED)

# Add source to this project's executable.
add_executable (GameOfLife "GameOfLife.cpp" "GameOfLife.h")

# Link SFML
target_link_libraries(GameOfLife sfml-graphics sfml-window)

错误消息:

CMake Error at CMakeLists.txt:16 (find_package): Could not find a configuration file for package "SFML" that is compatible with requested version "2.5".

The following configuration files were considered but not accepted:

D:/Program Files/SFML-2.5.1/lib/cmake/SFML/SFMLConfig.cmake, version: 2.5.1 (64bit)

最佳答案

我遇到了同样的问题,经过一番调查,我了解到斯坦利的评论是正确的。要使用64位工具链,只需运行:

cmake -G "Visual Studio 15 2017 Win64" ..

对于32位SFML版本,只需运行即可: cmake ..

关于c++ - CMake 64位和SFML 64位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54699430/

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