系统头文件cmath,cstdlib报错

时间:2021-01-05 20:13:12
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): error C2589: “(”:“::”右边的非法标记
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): error C2146: 语法错误: 缺少“)”(在标识符“fabs”的前面)
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): error C2066: 转换到函数类型是非法的
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): error C2059: 语法错误:“)”
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): error C2440: “类型转换”: 无法从“double”转换为“unknown-type (__cdecl *)(float)”
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cstdlib(): note: 没有使该转换得以执行的上下文
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): error C2589: “(”:“::”右边的非法标记
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): error C2146: 语法错误: 缺少“)”(在标识符“acos”的前面)
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): error C2066: 转换到函数类型是非法的
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): error C2059: 语法错误:“)”
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): error C2440: “类型转换”: 无法从“double”转换为“unknown-type (__cdecl *)(float)”
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\cmath(): note: 没有使该转换得以执行的上下文>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\xlocnum(): error C2589: “(”:“::”右边的非法标记
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\xlocnum(): error C2062: 意外的类型“unknown-type”
>C:\Program Files (x86)\Microsoft Visual Studio\\Community\VC\Tools\MSVC\14.11.\include\xlocnum(): error C2059: 语法错误:“)”

这种情况下,需要调整.cpp文件中的头文件引用顺序,例如

A.cpp中

#include X.h

#include Y.h

#include A.h

尝试调整一下X.h和Y.h和A.h的顺序