Errors when compiling examples with Code::Blocks

Official forum for the Chipmunk2D Physics Library.
Post Reply
kordman916
Posts: 7
Joined: Thu Dec 02, 2010 9:07 pm
Contact:

Errors when compiling examples with Code::Blocks

Post by kordman916 »

I've been trying to get the examples included with the latest chipmunk package to compile but I get these errors:

Code: Select all

/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crt1.o||In function `_start':|
(.text+0x18)||undefined reference to `main'|
/home/kordell/SDK/Chipmunk-5.3.2/Demo/Bounce.o||In function `update':|
Bounce.c|| undefined reference to `cpSpaceStep'|
/home/kordell/SDK/Chipmunk-5.3.2/Demo/Bounce.o||In function `add_box':|
Bounce.c|| undefined reference to `cpvlength'|
Bounce.c|| undefined reference to `cpMomentForPoly'|
Bounce.c|| undefined reference to `cpBodyNew'|
Bounce.c|| undefined reference to `cpSpaceAddBody'|
Bounce.c|| undefined reference to `cpPolyShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
/home/kordell/SDK/Chipmunk-5.3.2/Demo/Bounce.o||In function `init':|
Bounce.c|| undefined reference to `cpResetShapeIdCounter'|
Bounce.c|| undefined reference to `cpSpaceNew'|
Bounce.c|| undefined reference to `cpSpaceResizeActiveHash'|
Bounce.c|| undefined reference to `cpSegmentShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
Bounce.c|| undefined reference to `cpSegmentShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
Bounce.c|| undefined reference to `cpSegmentShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
Bounce.c|| undefined reference to `cpSegmentShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
Bounce.c|| undefined reference to `cpBodyNew'|
Bounce.c|| undefined reference to `cpSpaceAddBody'|
Bounce.c|| undefined reference to `cpSegmentShapeNew'|
Bounce.c|| undefined reference to `cpSpaceAddShape'|
Bounce.c|| undefined reference to `cpPivotJointNew2'|
Bounce.c|| undefined reference to `cpSpaceAddConstraint'|
/home/kordell/SDK/Chipmunk-5.3.2/Demo/Bounce.o||In function `destroy':|
Bounce.c|| undefined reference to `cpSpaceFreeChildren'|
Bounce.c|| undefined reference to `cpSpaceFree'|
||=== Build finished: 27 errors, 0 warnings ===|
I had this problem with SFML but I was able to fix it so what do I do here?
MrOz
Posts: 36
Joined: Tue Mar 02, 2010 11:36 pm
Contact:

Re: Errors when compiling examples with Code::Blocks

Post by MrOz »

I don't know if you're using my code::blocks project files or not, but you may find them helpful:

http://code.google.com/p/chipmunk-freeb ... p&can=2&q=

Take care,
-MrOz

:: EDIT ::
Sorry, I misinterpretted what you were saying. Looks like you aren't linking to libchipmunk.a. Open the project file, then right click on the project (from the left pane) and click "Build Options." In that window, on the left, there should be (likely) <Project File>, Release, Debug. Select your project name, then move to the linker tab. From there, add the library into link libraries. If you're using windows, you'll have to manually find the library, or in linux, just type "chipmunk" and gcc/ld should do the rest for you.
If that doesn't work, let me know.

Take care,
-MrOz
Last edited by MrOz on Mon Dec 06, 2010 9:27 am, edited 1 time in total.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Errors when compiling examples with Code::Blocks

Post by slembcke »

It looks like you are building the demo source files without linking it to the chipmunk library.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
kordman916
Posts: 7
Joined: Thu Dec 02, 2010 9:07 pm
Contact:

Re: Errors when compiling examples with Code::Blocks

Post by kordman916 »

And how would I go about doing that?

Linking the Chipmunk library that is...
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Errors when compiling examples with Code::Blocks

Post by slembcke »

That's more of a code blocks question than anything else. While I know there are a couple of code blocks users around, you probably won't get the quickest answer around here.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
kordman916
Posts: 7
Joined: Thu Dec 02, 2010 9:07 pm
Contact:

Re: Errors when compiling examples with Code::Blocks

Post by kordman916 »

Thanks you guys I linked libchipmunk.a and everything worked fine. :D
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests