I keep getting this error when compiling my C++ code. I have included all the headers and have been trouble shooting this code in VS code but with no luck. Any help much appreciated!
ConsoleApplication1.cpp:151:17: error: use of undeclared identifier 'experimental'
for (auto& p : experimental::filesystem::recursive_directory_iterator(path)) {
Any help on why I am getting the error "use of undeclared identifier 'experimental" would be much appreciated. I have the newest version of vs code installed on my mac and I am just doing g++ ConsoleAppliation1.cpp, and that is where the 4 warnings and 1 error show up. Here are the headers I am including
#include <iostream>
#include "stdafx.h"
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <map>
#include <thread>
#include <chrono>
#include <cstdlib>
#include "CSVRow.h"
#include "Definements.h"
#include "Node.h"
#include "Reverse.h"
#include "dijkstras.h"
#include "dijkstras2.h"
#include "smart_ptr.h"
#include "targetver.h"
//#include <Windows.h>
//#include <Wininet.h>
#include <experimental/filesystem>
//#include <tchar.h>
//#include <urlmon.h>
#include <ctime>
#include <unordered_map>
#include <utility>
#include "ConsoleApplication1.h"
#include <unordered_set>
Just a follow up, thanks to people who have commented I am now getting an
error: no member named 'experimental' in namespace 'std'
when doing
#ifdef __cpp_lib_filesystem
# include <filesystem>
namespace fs = std::filesystem;
#else
# include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
Does anyone know how to fix this error of not finding experimental in std when compiling? I am using the newest version of c++ on a mac, using VS code as my IDE