I need to write a program using the (experimental) C++17 file system, but clang on my Mac (macOS 10.12.03) does not seem to contain the file system header.
Since I have to use C++17 , I cannot use alternatives such as the Boost library.
When I try to compile an example program that includes a file system and iostream (and writes to cout )
#include <filesystem> #include <iostream> using namespace std; int main(){ cout << "test" << endl; }
The following error message appears:
>clang test.cpp -std=c++1z test.cpp:2:10: fatal error: 'filesystem' file not found #include <filesystem> ^ 1 error generated.
When I try to use GCC 6.3 (installed via homebrew), I 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 also tried using an experimental / file system that compiles with gcc , but seems to be trying to compile for iOS, leading to another error that seems to be related to iostream
Undefined symbols for 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 for architecture x86_64 collect2: error: ld returned 1 exit status
Version of my clang:
>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 am grateful for any useful contribution, since I could not find anything that resolved my problem so far (although I may have searched for the wrong terms).
If you need more information, I gladly provided it, but I hope this is all included.
c ++ gcc clang c ++ 17 macos
snoato
source share