kgoba / ft8_lib

FT8 library
MIT License
201 stars 67 forks source link

Fix M_PI related compilation isues on Linux #14

Closed kholia closed 2 years ago

kholia commented 2 years ago

On Ubuntu Linux, I run into the following M_PI compilation errors without the patch in this PR.

$ make
cc -O3 -std=c11 -I.  -c -o decode_ft8.o decode_ft8.c
decode_ft8.c: In function ‘hann_i’:
decode_ft8.c:38:27: error: ‘M_PI’ undeclared (first use in this function)
   38 |     float x = sinf((float)M_PI * i / N);
      |                           ^~~~
decode_ft8.c:38:27: note: each undeclared identifier is reported only once for each function it appears in
decode_ft8.c: In function ‘hamming_i’:
decode_ft8.c:47:32: error: ‘M_PI’ undeclared (first use in this function)
   47 |     float x1 = cosf(2 * (float)M_PI * i / N);
      |                                ^~~~
decode_ft8.c: In function ‘blackman_i’:
decode_ft8.c:58:32: error: ‘M_PI’ undeclared (first use in this function)
   58 |     float x1 = cosf(2 * (float)M_PI * i / N);
      |                                ^~~~
make: *** [<builtin>: decode_ft8.o] Error 1

This PR fixes these compilation errors.

kgoba commented 2 years ago

Thanks for the contribution! Had to time to check this on Linux, but will do next time on a virtual machine.