首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >[LLVM-9 clang-9 OSX]:std::filesystem::路径无法识别

[LLVM-9 clang-9 OSX]:std::filesystem::路径无法识别
EN

Stack Overflow用户
提问于 2019-09-27 16:55:43
回答 1查看 1.2K关注 0票数 3

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

我得到了以下错误:

代码语言:javascript
复制
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

我的代码:

代码语言:javascript
复制
#include <filesystem>

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

这是正常的吗?

EN

回答 1

Stack Overflow用户

发布于 2019-09-28 21:54:56

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

在CMake中:

代码语言:javascript
复制
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>)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58131130

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档