4

I am trying to compile a simple C++ program with std::filesytem header file included!

#include <iostream> #include <filesystem> int main() { std::cout << "Hello, World!" << std::endl; return 0; } 

On compiling I get the following error

In file included from C:/PROGRA~1/MINGW-~1/X86_64~2.0-W/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37, from C:\Users\{User}\CLionProjects\untitled3\main.cpp:2: C:/PROGRA~1/MINGW-~1/X86_64~2.0-W/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)': C:/PROGRA~1/MINGW-~1/X86_64~2.0-W/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path') || (__p.has_root_name() && __p.root_name() != root_name())) ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ 

I am on windows OS using MingW 8.1.0 and Clion as the IDE and as depicted on this https://en.cppreference.com/w/cpp/compiler_support seems like GCC 8.1 already supports std:fileystem

ToolChain config

EDIT: Language level is set in my CMakeList as shown below

set(CMAKE_CXX_STANDARD 17) 
3
  • 4
    Did you set the adequate language level? Commented Jun 16, 2018 at 18:13
  • 5
    It's a known problem. Commented Jun 16, 2018 at 18:17
  • 1
    my CMakeList has this set(CMAKE_CXX_STANDARD 17) @Vivick Commented Jun 16, 2018 at 18:43

1 Answer 1

4

I am on windows OS using MingW 8.1.0 and Clion as the IDE

I only implemented the MinGW support for std::filesystem recently and it's not present in GCC 8. It's currently only available in the GCC subversion trunk.

and as depicted on this https://en.cppreference.com/w/cpp/compiler_support seems like GCC 8.1 already supports std:fileystem

Only for non-Windows platforms. The Windows support is very different to the POSIX support and took a lot of extra work.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.