'C++ how to create folder

MY CURRENT CODE

#include<windows.h>
#include<fstream>
#include<direct.h>
#include<conio.h>
#include<sys/stat.h>
#include<filesystem>

int main(){
    int choice;
    std::string folder_n;

    std::cin >> choice;

    if(choice == 2){
        std::cout << "Enter folder name" << std::endl;
        std::cin >> folder_n;

        filesystem::create_directory(folder_n);
        std::cout << "created folder named " << folder_n << std::endl ;
            
    }

    return 0;
}

MY PROBLEM --> error: 'filesystem' has not been declared can anybody tell why is this error coming and how to fix it

Note : 1. filesystem is included in my c++ version because intellisense is showing filesystem
       2. I am using MinGw 
       3. My MinGW version is 9.2.0```


Solution 1:[1]

Create_directory works only with c++ 17.

In compiling, try g++ -std=c++17 file.cpp.

This is the site for all the file system function here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 XmanJob