尝试在 Visual C++ 中使用 CString 时出现语法错误

Syntax errors when trying to use CString in Visual C++

本文关键字:CString 错误 语法 Visual C++      更新时间:2023-10-16

我的项目对包含cstring不满意。它会产生以下错误:

    Error   10  error C2061: syntax error : identifier 'using'  C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecstring  18  1   fgdll
    Error   95  error C2061: syntax error : identifier 'tanhf'  C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecmath    26  1   fgdll
    Error   93  error C2061: syntax error : identifier 'tanf'   C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecmath    26  1   fgdll
    Error   51  error C2061: syntax error : identifier 'strxfrm'    C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecstring  26  1   fgdll
    Error   49  error C2061: syntax error : identifier 'strtok' C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecstring  26  1   fgdll
    Error   47  error C2061: syntax error : identifier 'strstr' C:Program Files (x86)Microsoft Visual Studio 10.0VCincludecstring  25  1   fgdll
...

如何解决这个问题?

好的,试试这个:

右键单击每段代码并转到:

Properties> C/C++> Advanced> Compile As并检查Compile as C++ Code(/TP)