"\include\qwt\qwt_math.h(105): error C2065: “M_PI_2”: 未声明的标识符"
2017-09-14 00:04
2481 查看
解决方法:
1) 在VS2010上使用Qwt时,需要在“项目”右键单击,选择“属性”,然后在“C/C++”中的“预处理器”配置组中的“预处理器定义”中加入“_USE_MATH_DEFINES”。
2)在相应的头文件中添加 #define _USE_MATH_DEFINES
原因如下:
在qwt_math.h中解释如下:
#if defined(_MSC_VER)
/*
Microsoft says:
Define _USE_MATH_DEFINES before including math.h to expose these macro
definitions for common math constants. These are placed under an #ifdef
since these commonly-defined names are not part of the C/C++ standards.
*/
#define _USE_MATH_DEFINES 1
#endif
如果在“预处理器定义”中添加_MSC_VER,有可能会导致其他第三方库无法编译通过。
而VS 的头文件math.h中也解释如下:
#if defined(_USE_MATH_DEFINES) && !defined(_MATH_DEFINES_DEFINED)
#define _MATH_DEFINES_DEFINED
/* Define _USE_MATH_DEFINES before including math.h to expose these macro
* definitions for common math constants. These are placed under an #ifdef
* since these commonly-defined names are not part of the C/C++ standards.
*/
/* Definitions of useful mathematical constants
* M_E - e
* M_LOG2E - log2(e)
* M_LOG10E - log10(e)
* M_LN2 - ln(2)
* M_LN10 - ln(10)
* M_PI - pi
* M_PI_2 - pi/2
* M_PI_4 - pi/4
* M_1_PI - 1/pi
* M_2_PI - 2/pi
* M_2_SQRTPI - 2/sqrt(pi)
* M_SQRT2 - sqrt(2)
* M_SQRT1_2 - 1/sqrt(2)
*/
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif /* _USE_MATH_DEFINES */
1) 在VS2010上使用Qwt时,需要在“项目”右键单击,选择“属性”,然后在“C/C++”中的“预处理器”配置组中的“预处理器定义”中加入“_USE_MATH_DEFINES”。
2)在相应的头文件中添加 #define _USE_MATH_DEFINES
原因如下:
在qwt_math.h中解释如下:
#if defined(_MSC_VER)
/*
Microsoft says:
Define _USE_MATH_DEFINES before including math.h to expose these macro
definitions for common math constants. These are placed under an #ifdef
since these commonly-defined names are not part of the C/C++ standards.
*/
#define _USE_MATH_DEFINES 1
#endif
如果在“预处理器定义”中添加_MSC_VER,有可能会导致其他第三方库无法编译通过。
而VS 的头文件math.h中也解释如下:
#if defined(_USE_MATH_DEFINES) && !defined(_MATH_DEFINES_DEFINED)
#define _MATH_DEFINES_DEFINED
/* Define _USE_MATH_DEFINES before including math.h to expose these macro
* definitions for common math constants. These are placed under an #ifdef
* since these commonly-defined names are not part of the C/C++ standards.
*/
/* Definitions of useful mathematical constants
* M_E - e
* M_LOG2E - log2(e)
* M_LOG10E - log10(e)
* M_LN2 - ln(2)
* M_LN10 - ln(10)
* M_PI - pi
* M_PI_2 - pi/2
* M_PI_4 - pi/4
* M_1_PI - 1/pi
* M_2_PI - 2/pi
* M_2_SQRTPI - 2/sqrt(pi)
* M_SQRT2 - sqrt(2)
* M_SQRT1_2 - 1/sqrt(2)
*/
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif /* _USE_MATH_DEFINES */
相关文章推荐
- "cout": 未声明的标识符(why 'cout' is not a member of 'std')
- 错误 1 error C2065: "endl": 未声明的标识符
- 解决error C2065:"..."未声明的标识符,C2065:语法错误: 标识符“...”
- error C2065: “CString”: 未声明的标识符
- "ora-12154 无法解析指定的连接标识符"问题的解决
- MFC 错误异常,用vs添加资源并为资源定义类后报错:error C2065 : 未声明的标识符
- error C2065: “HWND”: 未声明的标识符
- error C2065: “Count”: 未声明的标识符
- 关于错误: error C2065: “CCM_SETWINDOWTHEME”: 未声明的标识符 解决方法
- "compile fileTree(dir: 'libs', include: ['*.jar'])"to "provided fileTree(dir: 'libs', include: ['*.j
- 必须为元素类型 "insert" 声明属性 "resultType"
- error C2065: “IDD_REGDLG”: 未声明的标识符
- 使用控件时提示"未声明标识符"的解决方法
- 解决“error C3861: “pcap_findalldevs_ex”: 找不到标识符”以及“error C2065: “PCAP_SRC_IF_STRING”: 未声明的标识符”问题
- error C2065: “HDROP”: 未声明的标识符
- "SYS"."WM_CONCAT": 标识符无效
- error C2065: “vector”: 未声明的标识符
- error C2065: “IDD_DIALOG1” : 未声明的标识符
- web service 报错: Message: 引用了实体 "nbsp", 但未声明它。
- error C2065: “IDD_DIALOG1” : 未声明的标识符