首页 > 解决方案 > 无法在 SDK 中链接文件系统库

问题描述

我在使用 SDK 编译时尝试使用 C++17 中的文件系统库。我用了这个例子

#include <string>
#include <filesystem>

int main() {
    const std::string path = "/tmp/";
    for (const auto & entry : std::filesystem::directory_iterator(path))
        std::cout << entry.path() << std::endl;
}

链接库时出现问题(仅在使用 SDK 编译时,它适用于 Ubuntu。)
我应该以某种方式为 SDK 启用 c++17 吗?
还是应该将 stdc++fs 库添加到 SDK?

标签: yocto

解决方案


TOOLCHAIN_TARGET_TASK_append = " libstdc++-staticdev"

推荐阅读