Can’t find Configuration Property in Visual Studio (C++)

I’m trying to use gcd function from #include <numeric> in Visual Studio 2019 (Community version). However, using namespace std, visual studio just says that “gcd” is undefined. Based on my research, I’m supposed to change the C++ version. However, in the normal settings I can’t find “Configuration Properties” and right clicking on the project in the solution explorer to then select properties, just shows me an empty window (see emtpy-property-window picture).

Background info:

  • Created project with C++ (Cmake Project) in Visual Studio 2019 Community
  • Added a C++ file (.cpp) with main function and one class
  • For Building I’m using Cmake
  • Using namespace std and #inlcude <iostream> so far (with no problem)
  • When using #include <numeric> and then trying to use gcd(x,y), I get the previous described error-hint
  • Visual Studio tries to fix the error with adding namespace std, even though that’s already added.

Any idea to solve either problem?

Answer

The gcd function was added in C++17. You probably haven’t set the appropriate standard in your project settings. At least this is the exact issue you’ll get when trying to use std::filesystem::... with an older C++ standard with Visual Studio. (The file system library was added in C++17 too.)

In the project properties Configuration Properties > General > C++ Language Standard should be set to ISO C++17 Standard (/std::c++17) to make the code compile.

You can open the project properties by selecting Properties in the context menu for the target shown in the solution explorer btw; the properties shown in your screenshot just display some very basic information about the selected item.