Problem while running Box 2d
-
Hello All ,
i had seen an example at http://labs.qt.nokia.com/2010/02/26/qt-box2d-is-easy/it seems good., but the thing is should i include all the header and cpp files to my project it seems time consuming .,
m just out of ma mind how to compile my project ., just a hello world project in box 2d., will anyone hwlp me step by step how to getting start.,
i am new to Qt and Box2d.
please help me out.
-
well i dnno what is CMake and how to use it., and i had download box2d files which contain headers and cpp files nt able to find any library..
-
"LMGTFY":http://lmgtfy.com/?q=CMake
-
well what to do after use this CMake s/w?
-
I would advise you follow the suggestion packaged together with the sources. "On how to add libraries in Qt Creator":http://doc.qt.nokia.com/qtcreator-2.2/creator-project-qmake-libraries.html
-
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
-
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. -
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?
-
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..
-
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 -
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..