Edit

Compiler Error C2429

'language feature' requires compiler flag 'compiler option'

Remarks

The language feature requires the compiler option shown in the error message.

To set the C++ language standard in Visual Studio:

  1. Open the Property Pages dialog for your project.
  2. Select Configuration Properties > C/C++ > Language.
  3. For C++ Language Standard, select the standard specified by the error message, and then select OK or Apply. For example, select ISO C++17 Standard (/std:c++17) when the error specifies /std:c++17.

For command-line builds, add the specified option to the cl command.

Example

The following example generates C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17' when the compiler uses its default C++14 language standard. Nested namespace definitions require C++17 or later. To fix the error, compile with the /std:c++17 option or later, or define each namespace separately.

// C2429.cpp
namespace a::b { int i; } // C2429 when the compiler uses C++14.
                          // Use /std:c++17 or later, or define each namespace as follows:
                          // namespace a { namespace b { int i; }}

int main() {
    a::b::i = 2;
}

See also