หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
'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:
- Open the Property Pages dialog for your project.
- Select Configuration Properties > C/C++ > Language.
- 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;
}