visual studio compile c++ problem handling

Severity Code Description Item File Line Suppressed Status
Error C2760 Syntax error: unexpected token 'identifier', expected token ';'


Severity Code Description Item File Line Suppressed Status
Error C7510 'string_view': use of a type dependent name must be prefixed by 'typename'    


In the visual studio project properties, what does the language "conform to mode" mean?

Conformance Improvements in Visual Studio 2019 RTW (version 16.0)
Visual Studio 2019 RTW includes the following conformance improvements, bug fixes, and behavior changes for the Microsoft C++ Compiler (MSVC)
Note: C++20 features will be in /std:c+ Available in +latest mode until the C++20 implementation of the compiler and IntelliSense is complete. At that time, the /std:c++20 compiler mode will be introduced.

For the introduction of compliance improvement, please see the link:

https://docs.microsoft.com/zh-cn/cpp/overview/cpp-conformance-improvements?view=vs-2017


/permissive-: Enables all strict standards compliance compiler options and disables most Microsoft-specific compiler extensions (with some exceptions, such as __declspec(dllimport)). This option is enabled by default in Visual Studio 2017 version 15.5. The /permissive-compliance mode includes support for two-phase name lookup.


If you find the normal code before, in the VS2019 compiler, it will prompt that there is a language problem


Severity Code Description Item File Line Suppressed Status
Error C2065 'string_view': undeclared identifier    

Severity Code Description Item File Line Suppressed Status
Error (Active) E1097 Unknown property "no_init_all"    

Solution:

Just click Debug->Current Project Properties->C/C++->Language->Compliant mode; select No.

C++ language standard: C++17

 

Some simple basic libraries should not use higher versions of C++, because they cannot be used universally by compilers.

Guess you like

Origin blog.csdn.net/a2831942318/article/details/131256563