c++iphonesound-synthesis

expected unqualified-id before numeric constant in STK code


I included the The Synthesis ToolKit in C++ (STK) from stanford into my project and when I try to build I get the following error:

error: expected unqualified-id before numeric constant

in the second line written here, from the STK.h: (in the part where they declare their namespace)

const StkFloat PI = 3.14159265358979;
const StkFloat TWO_PI   = 2 * PI;  

My code was compiling before I added this, and surely there wouldn't be such a simple error in the STK code.

What am I doing wrong?


Solution

  • My guess is that some evil header defines PI as a macro.

    Either find and destroy that header, or put #undef PI before including the toolkit header.