Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem while running Box 2d
Forum Updated to NodeBB v4.3 + New Features

Problem while running Box 2d

Scheduled Pinned Locked Moved General and Desktop
17 Posts 2 Posters 5.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    loladiro
    wrote on last edited by
    #8

    Have you built Box2D according to the instructions in the source package?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      karankumar1609
      wrote on last edited by
      #9

      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.

      Cheers....
      Karan Kr.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        loladiro
        wrote on last edited by
        #10

        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)

        1 Reply Last reply
        0
        • K Offline
          K Offline
          karankumar1609
          wrote on last edited by
          #11

          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?

          Cheers....
          Karan Kr.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            loladiro
            wrote on last edited by
            #12

            I believe you have everything you need, if you just follow the instructions in the original blog post.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              karankumar1609
              wrote on last edited by
              #13

              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..

              Cheers....
              Karan Kr.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                loladiro
                wrote on last edited by
                #14

                Now we're getting closer to the problem. What exactly is the error you get when trying to build it on windows?

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  karankumar1609
                  wrote on last edited by
                  #15

                  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 += -lbox2d

                  and 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

                  Cheers....
                  Karan Kr.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    loladiro
                    wrote on last edited by
                    #16

                    You have to adjust the paths of course. The include folder will be created when you build the library.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      karankumar1609
                      wrote on last edited by
                      #17

                      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 += -lbox2d

                      but the problem still occures..

                      Cheers....
                      Karan Kr.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved