[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - noob's guide to using chipmunk with C++ anyone?

noob's guide to using chipmunk with C++ anyone?

Official forum for the .

noob's guide to using chipmunk with C++ anyone?

Postby Rawlyn » Sat Jan 23, 2010 6:30 am

Hey all,

I've been a big fan of pymunk for a while now, but something I'm working on could do with a little performance boost - so I've decided to try my hand at C++ and OpenGL. I downloaded chipmunk and ran "cmake ." (without the demos) and "make" and that all seems to be fine.

Problem is, I have no idea where to go from there.

This may seem like a really nooby thing to be asking (and rightly so), but what do I need to put into my source to include chipmunk? Do I need to do anything special with the options for g++ when I compile? Do I need to set up any environment variables to know where anything is? A step-by-step example would be great if anyone has the time.

Thanks in advance,
Rawlyn.
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am

Re: noob's guide to using chipmunk with C++ anyone?

Postby Rawlyn » Sat Jan 23, 2010 7:30 am

Update.... after a bit of fiddling, I've done this much:

- I ran "sudo make install" and crossed my fingers. This seemed to install all the headers to /usr/local/include and the lib to /usr/local/lib .

- I've set the environment variables
CPLUS_INCLUDE_PATH=/usr/local/include/chipmunk (g++ looks here for include apparently)
LD_LIBRARY_PATH=/usr/local/lib (found this in a tutorial I was looking at for hints)

Now I can compile using:

g++ chiptest.cpp -o chiptest -lchipmunk -Wall -g

and my test program (includes chipmunk.h, calls cpInitChipmunk(), ends) now executes.

Does this sound about right to those of you who know about these things? I can't help but think there's something wrong with the environment variable to give the search path to the lib.
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am

Re: noob's guide to using chipmunk with C++ anyone?

Postby Tam Toucan » Sat Jan 23, 2010 4:00 pm

The -I option tells gcc where to look for header files. So -I /usr/local/include/chipmunk will add it to the search path so that #include <chipmunk.h> will be found.

The -L option tells the linker where to look for libraries specified by -l i.e. where to look for libchipmunk.a if you give it -lchipmunk.

You can have mulitple -I and -L options to add lots of paths.

LD_LIBRARY_PATH is the env var for the path to look for dynamically loaded libraries i.e. the linker can take a static library (.a) and put the code into your program at link time. Or it can take a dynamic library (.so) and look for it when your program runs.

You want to link statically since otherwise anyone running your program would need to have the library installed (or you would need to give them a copy and it be placed somewhere in the search path).

I actually don't install chipmunk into /usr/local and instead just have it as a library compiled as part of my projects. The reason I do this is it makes it easier to add debug (to find out when I've screwed up not Chipmunk :)), but if you're not needed to step through the code or debug it a lot then installing it is the way to go.

Hopefully of some help.
User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: noob's guide to using chipmunk with C++ anyone?

Postby Rawlyn » Sun Jan 24, 2010 1:26 pm

Thanks Tom, that information is very useful to me right now!

How would I go about compiling chipmunk into a project like you suggest?
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am

Re: noob's guide to using chipmunk with C++ anyone?

Postby Tam Toucan » Mon Jan 25, 2010 4:23 pm

User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: noob's guide to using chipmunk with C++ anyone?

Postby Rawlyn » Thu Jan 28, 2010 8:56 am

Thanks again Tom, that's cleared everything up for me :) I was missing the -L option, so the static link to libchipmunk.a wasn't happening. With that in place everything builds perfectly.

Thanks also for the advice on IDEs. Currently I just use gedit, but will no doubt eventually be grateful for something to manage my code.
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am

Re: noob's guide to using chipmunk with C++ anyone?

Postby Rawlyn » Thu Jan 28, 2010 10:32 am

I just noticed your name is Tam, not Tom. Sincere apologies!
Rawlyn
 
Posts: 33
Joined: Mon Mar 30, 2009 3:06 am


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 3 guests