I am trying to use the <filesystem>
library, and for that I need C 17 or later. I went to the project properties, to General, then to "C language standard", and set the language to C 20. But when I compile, it says that the library is only available with C 17 or later, and doesn't let me use it.
I went to the <filesystem>
header document and saw that the _HAS_CXX17
macro was defined as false, which was causing the problems. I went to the location where the _HAS_CXX17
macro was defined, vcruntime.h
, and tried setting it to true, but Visual Studio doesn't allow users to edit that file.
This problem is puzzling to me, as I have used the <filesystem>
library in other projects, and the C version updated without issues. I have not changed anything in my settings of the overall Visual Studio application, nor have I messed with any of its files before.
CodePudding user response:
As I already suspected in the comments and as confirmed by the OP, the problem was that the OP changed the properties for a configuration and/or platform which was not the currently active one. It is quite easy to forget to select the desired one in the properties dialog since the combo boxes in the properties are not synced with the ones that determine the active configuration/platform. See the following image: