c++ - macOS Clang C++17 filesystem header not found -
i need write program using (experimental) c++17
filesystem library clang
on mac (macos 10.12.03) doesn't seem have filesystem header included.
since i'm required use c++17
, cannot use alternatives boost
library.
when try compile sample program includes filesystem , iostream
(and writes cout
)
#include <filesystem> #include <iostream> using namespace std; int main(){ cout << "test" << endl; }
i following error message:
>clang test.cpp -std=c++1z test.cpp:2:10: fatal error: 'filesystem' file not found #include <filesystem> ^ 1 error generated.
when try same using gcc 6.3 (installed via homebrew) get:
>gcc-6 test.cpp -std=c++17 test.cpp:2:22: fatal error: filesystem: no such file or directory #include <filesystem> ^ compilation terminated.
i tried using experimental/filesystem instead compiles using gcc
seems try compile ios leading error seems related iostream
undefined symbols architecture x86_64: "std::ios_base::init::init()", referenced from: __static_initialization_and_destruction_0(int, int) in ccd5qivt.o "std::ios_base::init::~init()", referenced from: __static_initialization_and_destruction_0(int, int) in ccd5qivt.o ld: symbol(s) not found architecture x86_64 collect2: error: ld returned 1 exit status
the version of clang is:
>clang --version apple llvm version 8.0.0 (clang-800.0.42.1) target: x86_64-apple-darwin16.4.0 thread model: posix installeddir: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin
i'm grateful helpful input since couldn't find solved problem far (although might have been searching wrong terms).
if need more information i'll gladly provide hope have included everything.
libc++, c++ standard library on os x, has not moved <experimental/filesystem>
<filesystem>
yet because specification not stable.
hopefully <filesystem>
part of clang 6.0 release. (edit: missed 5.0)
Comments
Post a Comment