gpt4 book ai didi

c++ - [LLVM-9 clang-9 OSX]: std::filesystem::path 无法识别

转载 作者:太空宇宙 更新时间:2023-11-04 12:32:26 25 4
gpt4 key购买 nike

在 OSX Mojave 上使用 brew upgrade llvm 升级到版本 LLVM-9 后你好

我收到以下错误:

In file included from /Users/roman/CLionProjects/Milerius/antara-gaming-sfml-template/cmake-build-debug/_deps/antara-gaming-sdk-src/modules/core/antara/gaming/core/real.path.cpp:17:
/Users/roman/CLionProjects/Milerius/antara-gaming-sfml-template/cmake-build-debug/_deps/antara-gaming-sdk-src/modules/core/antara/gaming/core/real.path.hpp:23:22: fatal error: 'path' is unavailable: introduced in macOS 10.15
std::filesystem::path binary_real_path() noexcept;
^
/usr/local/opt/llvm/bin/../include/c++/v1/filesystem:738:24: note: 'path' has been explicitly marked unavailable here

我的代码:

#include <filesystem>

namespace antara::gaming::core
{
std::filesystem::path binary_real_path() noexcept;
std::filesystem::path assets_real_path() noexcept;
}

这正常吗?

最佳答案

其中一种解决方案是使用:-mmacosx-version-min=10.15 编译器标志

在 CMake 中:

add_library(antara_cross_filesystem INTERFACE)
add_library(antara::cross_filesystem ALIAS antara_cross_filesystem)

target_link_libraries(antara_cross_filesystem INTERFACE
$<$<AND:$<PLATFORM_ID:Linux>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>
$<$<AND:$<PLATFORM_ID:Darwin>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:c++fs>)
target_compile_options(antara_cross_filesystem INTERFACE
$<$<AND:$<PLATFORM_ID:Darwin>,$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,8.0>>:-mmacosx-version-min=10.15>)

关于c++ - [LLVM-9 clang-9 OSX]: std::filesystem::path 无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58131130/

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