Search code examples
c++eclipse-cdtc++17

C++17 support Eclipse Neon


I read here that C++17 is feature-complete although the specifications are not completely ready yet. How can I use C++17 features in my code, especially in Eclipse CDT (Neon)?

Specifically, I would like to use the filesystem to be able to iterate over directories easily.


Solution

  • Both libc++ and libstdc++ have a std::experimental::filesystem in recent versions. I'm unaware of either having std::filesystem directly; C++17 isn't released quite yet, that seems reasonable.

    boost has boost::filesystem, which differs in a few ways but is structured nearly identically. Code written to use boost::filesystem can be relatively easily ported to std::filesystem.

    As an example of an incompatibility, boost has a singular flag enum, while std has a plural flag enum bitfield with more settings.

    You may have to pass -std=c++1z to the compiler, check your libc++ or libstdc++ version, switch which one you are using, install a new one, etc. Or install boost, and use its filesystem library which C++17s was based off of.