zoukankan      html  css  js  c++  java
  • “M_PI_2”: 重复定义的宏

    问题警告:“M_PI_2”: 重复定义的宏

    分析:在Visual Studio上使用math.h库时与其他库数学库冲突,我们可以通过添加宏定义“_USE_MATH_DEFINES”来消除math.h定义的宏。

    #if defined _USE_MATH_DEFINES && !defined _MATH_DEFINES_DEFINED
        #define _MATH_DEFINES_DEFINED
        // Definitions of useful mathematical constants
        //
        // 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 or C++ standards
        #define M_E        2.71828182845904523536   // e
        #define M_LOG2E    1.44269504088896340736   // log2(e)
        #define M_LOG10E   0.434294481903251827651  // log10(e)
        #define M_LN2      0.693147180559945309417  // ln(2)
        #define M_LN10     2.30258509299404568402   // ln(10)
        #define M_PI       3.14159265358979323846   // pi
        #define M_PI_2     1.57079632679489661923   // pi/2
        #define M_PI_4     0.785398163397448309616  // pi/4
        #define M_1_PI     0.318309886183790671538  // 1/pi
        #define M_2_PI     0.636619772367581343076  // 2/pi
        #define M_2_SQRTPI 1.12837916709551257390   // 2/sqrt(pi)
        #define M_SQRT2    1.41421356237309504880   // sqrt(2)
        #define M_SQRT1_2  0.707106781186547524401  // 1/sqrt(2)
    #endif
    View Code

    解决方法:

    需要在“项目”右键单击,选择“属性”,然后在“C/C++”中的“预处理器”配置组中的“预处理器定义”中加入“_USE_MATH_DEFINES”。

        2)在相应的头文件中添加  #define _USE_MATH_DEFINES

  • 相关阅读:
    11.10 安装GMONE3,卸载 UNITY和UNITY 2D
    Ubuntu 11.10 使用Gnome3 快捷键Alt+F2无效的解决办法
    Ioc容器应用浅析EasyJF学习
    JPA批注参考
    MVC(Model/View/Controller)EasyJF学习
    Subversion使用手記
    Eclipse 插件 esourceBundleEditor
    用 Subversion 构建版本控制环境
    TortoiseSVN使用
    自信的真正含义NLP
  • 原文地址:https://www.cnblogs.com/2018shawn/p/11368341.html
Copyright © 2011-2022 走看看