Problem while running Box 2d
-
wrote on 8 Jul 2011, 19:42 last edited by
not i installed the CMake s/w and trying to execute my box-2d code., but which configuration shpuld be used? m using windows-7
-
wrote on 8 Jul 2011, 19:43 last edited by
Have you built Box2D according to the instructions in the source package?
-
wrote on 8 Jul 2011, 19:46 last edited by
these are the instructions., but its for visual studio and unix., cant find for Qt for windows.
Box2D uses CMake to describe the build in a platform independent manner.
First download and install cmake from cmake.org
For Microsoft Visual Studio:
- Run the cmake-gui
- Set the source directory to the path of Box2D on your PC (the folder that contains this file).
- Set the build directory to be the path of Box2D/Build on your PC.
- Press the Configure button and select your version of Visual Studio.
- You may have to press the Configure button again.
- Press the Generate button.
- Open Box2D/Build/Box2D.sln.
- Set the Testbed or HelloWorld as your startup project.
- Press F5 or Ctrl-F5 to run.
For Unix platforms, say the following on a terminal: (Replace $BOX2DPATH with the directory where this file is located.)
cd $BOX2DPATH/Build
cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON ..
make
make install
You might want to add -DCMAKE_INSTALL_PREFIX=/opt/Box2D or similar to the cmake call to change the installation location. make install might need sudo. -
wrote on 8 Jul 2011, 19:51 last edited by
Well on windows you have the chance to use either visual studio or MinGW in which case you need to follow the instructions for unix, replacing make with mingw32-make (either use the complete path or have it in your PATH environment variable)
-
wrote on 8 Jul 2011, 19:58 last edited by
actually box 2d already have a cmake file., but i want to know how to build it for Qt .
i use visual studio 10 version to cmake box2d code., but unable to generate cmake file.,
i think there is no other better way just to use existing cmake file.,so atlast i have a previous cmake file., thn how to use this?
-
wrote on 8 Jul 2011, 20:13 last edited by
I believe you have everything you need, if you just follow the instructions in the original blog post.
-
wrote on 8 Jul 2011, 20:22 last edited by
actually the code provided in the original post is for linux., and i am working on windows. thats what the problem is., and i dnno how to make it work in windows..
-
wrote on 8 Jul 2011, 20:30 last edited by
Now we're getting closer to the problem. What exactly is the error you get when trying to build it on windows?
-
wrote on 8 Jul 2011, 20:38 last edited by
well the file he just contain a pro and a main.cpp file.,
.pro file contains
SOURCES += main.cpp
INCLUDEPATH += /home/ahanssen/Box2D_v2.0.1/Box2D/Include
LIBPATH += /home/ahanssen/Box2D_v2.0.1/Box2D/Source/Gen/float
LIBS += -lbox2dand i think the include path and the lib path create error for me. coz in windows path not start with '/' (root.), and even i am unable to find "include" folder in my box2d directory as mentioned in INCLUDEPATH+= .../Include
and the error i got while compiling is :
box2d.h no such file or directory , bodydef was not declared ....... etc.... etc -
wrote on 8 Jul 2011, 20:43 last edited by
You have to adjust the paths of course. The include folder will be created when you build the library.
-
wrote on 8 Jul 2011, 20:49 last edited by
i had made a change and copy my box2d folder in my working folder.,
SOURCES += main.cpp
INCLUDEPATH += $$PWD/Box2D_v2.0.1/Box2D/Include
LIBPATH += $$PWD/Box2D_v2.0.1/Box2D/Source/Gen/float
LIBS += -lbox2dbut the problem still occures..
16/17