Page 1 of 1

Compiling on Code::Blocks?

Posted: Thu Feb 17, 2011 5:14 pm
by neos300
Has anyone been able to compile Chipmunk on Code::Blocks with gcc? I keep getting compiler errors.

Re: Compiling on Code::Blocks?

Posted: Thu Feb 17, 2011 5:27 pm
by slembcke
There is this thread: http://www.slembcke.net/forums/viewtopi ... ocks#p6052

You might also try generating a code blocks project from the cmake files.

Re: Compiling on Code::Blocks?

Posted: Thu Feb 17, 2011 5:33 pm
by neos300
Here are the compiler errors:

C:\c++\ChipmunkLib\chipmunk.c:70: error: 'M_PI' undeclared (first use in this function)
C:\c++\ChipmunkLib\chipmunk.c:70: error: (Each undeclared identifier is reported only once
C:\c++\ChipmunkLib\chipmunk.c:70: error: for each function it appears in.)
C:\c++\ChipmunkLib\chipmunk.c: In function 'cpAreaForSegment':
C:\c++\ChipmunkLib\chipmunk.c:85: error: 'M_PI' undeclared (first use in this function)

Apparently M_PI is gone in C99, is Chipmunk really C99 compliant?

Re: Compiling on Code::Blocks?

Posted: Thu Feb 17, 2011 6:38 pm
by slembcke
It seems you are correct, and according to wikipedia M_PI was never actually part of the C standard math library anyway. Good to know. Apparently o

A simple define statement will fix that though:
#define M_PI 3.14159265358979323846264338327950288

I also committed the fix to trunk.