1

i am writing an application in C89, and i need to access the M_PI defined variable. I have included the math.h header file, but it still tells me M_PI is undeclared.

this is the code snippet where i use M_PI:

#include <math.h>

void test_MPI(){

    float course_in_rad;
        float lat_in_rad;

        course_in_rad = 55.0 * M_PI / 180.0;
        lat_in_rad = 52.092 * M_PI / 180.0;

}

The error that is produced is:

error: ‘M_PI’ undeclared (first use in this function)

Any ideas?

chris edwards
  • 1,332
  • 4
  • 13
  • 31

0 Answers0