### Using M_PI gives error even after including math.h ?

If you look at the math.h header file, the PI math constant M_PI and other values will be defined at the end of the file and just above that there will be a conditional #define pre-processor statement. Solution :- Just type in #define _USE_MATH_DEFINES after before including math.h #define _USE_MATH_DEFINES #include <math.h>