Box2D with Linux

From Box2D Wiki

Box2D is written in C++, and hence it's possible to compile and run it on other platforms as well. This page shows how to use it with Linux :) Basically there's the choice between compiling Box2D with and without cmake.

Step 1: Download latest Box2D

Check out the latest SVN Source

svn co https://box2d.svn.sourceforge.net/svnroot/box2d box2d
cd box2d

Compile Box2D with make (without cmake)

Update the Makefile in Source/ to also build .so libraries

# Use this line as second one:
TARGETS+= Gen/float/libbox2d.so Gen/fixed/libbox2d.so

# And these lines below, after the according libbox2d.a parts
Gen/float/libbox2d.so:  $(addprefix Gen/float/,$(SOURCES:.cpp=.o))
   $(CXX) -shared -fPIC -C $^ -o $@ -lm -lgcc

Gen/fixed/libbox2d.so:  $(addprefix Gen/fixed/,$(SOURCES:.cpp=.o))
   $(CXX) -shared -fPIC -C $^ -o $@ -lm -lgcc

Build the Sources

# 2. run 'make'
make

# 3. This should have created the shared libraries in Source/Gen/.... Copy libbox2d.a (and .so) file to Library/
cp Source/Gen/float/libbox2d.* Library/


See this forum: http://www.box2d.org/forum/viewforum.php?f=5

Image:Icon-building.png‎ Building Instructions
C++ AS3
TOOLBOX
LANGUAGES