Compiling the Box2d Tesbed is supposed to be simple:
from iforce2d:
Download the Box2D source code archive from here. If you want to use the terminal all the way, you could also do this (if wget is not available, use yum to install it):
wget http://box2d.googlecode.com/files/Box2D_v2.1.2.zip
Use the following commands to unzip and build it. [...]
unzip Box2D_v2.1.2.zip cd Box2D_v2.1.2/Box2D/Build cmake .. make
( These instructions are pretty old, I did get my source with git clone https://github.com/erincatto/Box2D.git
)
Running cmake ..
from Box2D/Build
in the freshly cloned directory causes multiple errors :
CMake Error at Testbed/CMakeLists.txt:84 (add_executable):
Cannot find source file:
Framework/imgui.h
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
CMake Error: Cannot determine link language for target "glfw".
CMake Error: CMake can not determine linker language for target: glfw
Of course, make
fails:
[ 42%] Building CXX object Box2D/CMakeFiles/Box2D.dir/Dynamics/b2Body.cpp.o
/home/cabri/Documents/Box2D/Box2D/Box2D/Dynamics/b2Body.cpp: In member function ‘void b2Body::DestroyFixture(b2Fixture*)’:
/home/cabri/Documents/Box2D/Box2D/Box2D/Dynamics/b2Body.cpp:216:17: error: ‘nullptr’ was not declared in this scope
if (fixture == nullptr)
^
Box2D/CMakeFiles/Box2D.dir/build.make:566: recipe for target 'Box2D/CMakeFiles/Box2D.dir/Dynamics/b2Body.cpp.o' failed
make[2]: *** [Box2D/CMakeFiles/Box2D.dir/Dynamics/b2Body.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'Box2D/CMakeFiles/Box2D.dir/all' failed
make[1]: *** [Box2D/CMakeFiles/Box2D.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Multiple similar questions can be found on these sites, but none has an answer. I know I can install box2d with
sudo apt-get install libox2d
but I'd like to have the testbed as well.
How can this be done ?
See Question&Answers more detail:os