#ifndef M_PI
#define M_PI acos(-1)
#endif
The code snippet after #include <math.h> guarantees correct operation. It would be better to additionally check that we do not have a C ++ 20 or newer vessel and if we are to use the stencil constant from the C ++ standard library. The M_PI macro is an extension of the C standard.