[LLVM-9 clang-9 OSX]:无法识别std :: filesystem :: path [英] [LLVM-9 clang-9 OSX]: std::filesystem::path unrecognized

查看:267
本文介绍了[LLVM-9 clang-9 OSX]:无法识别std :: filesystem :: path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用brew upgrade llvm

我遇到以下错误:

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编译器标志

of one the solution is to using: -mmacosx-version-min=10.15 compiler flags

在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>)

这篇关于[LLVM-9 clang-9 OSX]:无法识别std :: filesystem :: path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆