Due to build error (math library non-conformance), the project can't be built on certain platforms/IDE's. For this issue report i reproduced it using Visual Studio 2022 17.10.
According to web sources, it is because 'M_PI' is not part of math.h or cmath in either C or C++, therefore i can imagine this out-of-the-box failure will appear for multiple environments.
Web sources suggest one of these solutions. I suggset speexdsp picks one for implementation.
Microsoft way (docs): "Math Constants are not defined in Standard C/C++. To use them, you must first define _USE_MATH_DEFINES and then include cmath or math.h BEFORE any other headers":
#define _USE_MATH_DEFINES
#include <cmath>
#incude other headers...
Different approaches, as you decide on portability and choice:
Due to build error (math library non-conformance), the project can't be built on certain platforms/IDE's. For this issue report i reproduced it using Visual Studio 2022 17.10.
The error:
speexdsp\libspeexdsp\testresample2.c(57,43): error C2065: 'M_PI': undeclared identifier
Happens here: libspeexdsp/testresample2.c Line 57
According to web sources, it is because 'M_PI' is not part of math.h or cmath in either C or C++, therefore i can imagine this out-of-the-box failure will appear for multiple environments.
Web sources suggest one of these solutions. I suggset speexdsp picks one for implementation.
Microsoft way (docs): "Math Constants are not defined in Standard C/C++. To use them, you must first define _USE_MATH_DEFINES and then include cmath or math.h BEFORE any other headers":
Different approaches, as you decide on portability and choice:
GCC way:
Compilers that support C++ 20 (use header numbers and constant pi), like so:
cc @tmatth