0

based on this thread it is still not working although i changed to ISO C++17 Standard (/std:c++17)
in c++ -> language in VS 2019 config.
also try to set :

#ifdef _WIN32 
 #define _HAS_CXX17 1
#endif

it worked but to day it gave me compilation error all over :

warning C4005: '_HAS_CXX17': macro redefinition
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vcruntime.h(277): message : see previous definition of '_HAS_CXX17'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(315,10): error C2061: syntax error: identifier '_Enable_if_execution_policy_t'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(315,86): error C2988: unrecognizable template declaration/definition
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(315,86): error C2059: syntax error: '='
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(337,10): error C2061: syntax error: identifier '_Enable_if_execution_policy_t' 

is there any solution to this ?

user63898
  • 29,839
  • 85
  • 272
  • 514
  • You're not supposed to be defining any compiler reserved keywords, that start with an underscore and a capital letter, or that start with two underscores. This is why. – SparkyPotato Feb 03 '21 at 06:58
  • At the risk of stating the obvious, make sure you set `/std:c++17` for all configurations/platforms, and there is no per-project or per-file override. A barebones console app with `#include ` and `std::cout << std::filesystem::temp_directory_path() << std::endl;` compiles and works fine here (no `#define _HAS_CXX17` needed). – dxiv Feb 03 '21 at 07:18

0 Answers0