Hi, I read this https://github.com/robotology/community/discussions/81 but it's too big. I spent a lot of time to try to remove the Warning about M_PI but I always failed, so I show a screenshot to tell "What do you have in mind to try to hide the warning about M_PI?", because my C++ project is so big and all I have to do is to show screenshot.
There are many lines #include <math.h> in other source codes but as the screenshot tells, the warning is inside the project "imgui_backend" (file: math.h), and that project only has 2 files using that "math library" (imgui_internal.h and imgui_demo.cpp). So, do you think attempting to try repeating the same fix in all the #include <math.h> in other sources not in the indicated project will fix the problem? But there are A LOT of that line of math include, and it will ruin the internal source codes, I tried it at first but it didn't fix, it's too difficult because I'm not sure if I 100% did it or 95% did, too difficult because there are a lot of lines (#include <math.h>) everywhere.
I always did this every time I compile my project for this "Specific" problem that's very hard to fix:
- Clean the solution and re-compile the project, because cleaning is sometimes a fix of bug on the C++ editor that's almost impossible to detect.
In the link I showed in the beginning, people say to #define _USE_MATH_DEFINES before #include <cmath>
The following doesn't solve the problem either because there's still the warning:
The code below is applied in those 2 files imgui_internal.h and imgui_demo.cpp:
// Remove the Warning C4005 'M_PI': macro redefinition https://github.com/robotology/community/discussions/81
// Before:
//#include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
// After:
#undef _USE_MATH_DEFINES // Because it's already defined in the CMakeLists.txt.
#define _USE_MATH_DEFINES
#undef M_PI // Attempting to force undefine it.
#include <cmath> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
But that doesn't remove the warning.