Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML box-2d demo example - how to compile
QtWS25 Last Chance

QML box-2d demo example - how to compile

Scheduled Pinned Locked Moved QML and Qt Quick
18 Posts 4 Posters 12.4k Views
  • 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.
  • P Offline
    P Offline
    profuma
    wrote on last edited by
    #1

    I found qml box 2d demo at
    https://projects.developer.nokia.com/qmlbox2ddemo
    I also saw a question in the 'discussion' for which I too wanted an answer Could some one answer this -
    I found that the project has been put up by Digia employee so I thought I will cut and paste the question here
    *
    Hi Running the project just shows a blank screen . Could you explain how to use this project ? I also find that

    anchors.fill: parent , density: 1; friction: 0.4; restitution: 0.5; are all shown as 'Not a valid name'.

    Can you explain how to compile this project

    thanks in advance*

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      You need build qml-box2d lib/plugin first. You can get the source code from"gitorious":https://gitorious.org/qml-box2d
      There also have qml-box2d demos :D

      Chuck

      1 Reply Last reply
      0
      • P Offline
        P Offline
        profuma
        wrote on last edited by
        #3

        Thank you. I did try to compile using Cmake and Visual studio 9 (2008) but I was unable to compile . I keep getting CMakeLists.txt not found error. Is there any other way to get the compiled plugin? or a way to compile properly? Thanks

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chuck Gao
          wrote on last edited by
          #4

          What's the error when compile ? Why not use Qt to compile it ?

          Chuck

          1 Reply Last reply
          0
          • P Offline
            P Offline
            profuma
            wrote on last edited by
            #5

            Thanks for reply.I tried with Qt too. I get the error
            @F:\QtSDK\qmlbox2ddemo\src\qml-box2d\box2dfixture.h:26: error: Box2D.h: No such file or directory
            @
            That is #include <Box2D.h> is not included error though I find that the header file is available in the path.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Chuck Gao
              wrote on last edited by
              #6

              Ok, it seems you didn't add the right include path(using INCLUDEPATH += ... in .pro file). It's not a big deal

              Chuck

              1 Reply Last reply
              0
              • P Offline
                P Offline
                profuma
                wrote on last edited by
                #7

                Thanks.In the intervening time between my question and your answer, I did include the path in pro file and the project SEEMS to have compiled but I still get a blank screen. The error corresponding to 'fixtures in Box 2d' density, friction and restitution still persist.
                FOR eg-
                @fixtures: Box {
                anchors.fill: parent
                density: 1;
                friction: 0.4;
                restitution: 0.5;
                }
                @
                All the above are shown as 'not a valid property name'
                Thanks for your answers. Hope you may be able to figure out the error

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Chuck Gao
                  wrote on last edited by
                  #8

                  Do you import the qml-box2d plugin? Or do you make install after compile?

                  Chuck

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    profuma
                    wrote on last edited by
                    #9

                    Hi
                    Sorry for late reply . I make install after compile. I just can't understand why it won't work when everyone seem to have no problem with it :-(

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Chuck Gao
                      wrote on last edited by
                      #10

                      Can you paste your code ? Do you build qml-box2d plugin before you compile the qmlbox2ddemo ?

                      Chuck

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        profuma
                        wrote on last edited by
                        #11

                        Thank you for helping thus far. I have washed my hands off Box2d and switched over to Bullet physics which I could compile and use with no hassle. Thanks again
                        If any one is interested, do check out QML and Bullet Physics integration here
                        https://bitbucket.org/jtoivola/qml-physics/downloads

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          deviant7
                          wrote on last edited by
                          #12

                          [quote author="Chuck Gao" date="1311949843"]You need build qml-box2d lib/plugin first.[/quote]

                          How can I build the plugin ?

                          I found box2d.pro file, opened and when I click Run it opens a window that asks for an executable ("Could not find the executable, please specify one.", with 3 fields: Executable, Arguments, WD).

                          I also tried to copy the plugin directory in my project file and then use import in my QML files but with no luck: module not installed

                          I'm from hours on google, forums, docs but find nothing that really helps me.

                          Can someone explain step-by-step how he installed the Box2D plugin successfully ?

                          Thanks a lot,
                          in advance

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            Chuck Gao
                            wrote on last edited by
                            #13

                            It's a plugin, not a executable one. The simple way to build it was: open your cmd window(.pro folder), and type: make & make install

                            If you using Qt Creator, you need specified a step to "make install", and "Run" is not needed, just ignore it.

                            Chuck

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              madil
                              wrote on last edited by
                              #14

                              hi chuck geo,
                              i also have same issue ,i can't run box 2d example code can you guide me for this .or provide me the correct sample code for it. thanks

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                Chuck Gao
                                wrote on last edited by
                                #15

                                [quote author="madil" date="1319106238"]hi chuck geo,
                                i also have same issue ,i can't run box 2d example code can you guide me for this .or provide me the correct sample code for it. thanks [/quote]

                                Hi madil,
                                Which error do you get ?

                                Chuck

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  madil
                                  wrote on last edited by
                                  #16

                                  hi chuck,
                                  i am not able to run any sample example .i am using box 2d 2.2.1 kindly help me on this .the Error on my code is.
                                  module "Box2D" is not installed
                                  import Box2D 1.0
                                  if you have any sample example so kindly give it you me and also define the steps how to run it .Thanks
                                  Regard
                                  madil.

                                  1 Reply Last reply
                                  0
                                  • C Offline
                                    C Offline
                                    Chuck Gao
                                    wrote on last edited by
                                    #17

                                    Hi,
                                    Check your import path first(desktop for exmaple):
                                    YourQtSDK\Desktop\Qt\YourQtVersion\mingw\imports
                                    Can you find Box2D there ?

                                    Chuck

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      madil
                                      wrote on last edited by
                                      #18

                                      hi,
                                      i can put Box 2D where QTSDK installed like(C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Box2D_v2.2.1). and i run my project from this "c:\" but this error comes

                                      C:\Box2DDemo_v0_2\qmlbox2ddemo\box2ddemo-build-desktop-Qt_4_7_4_for_Desktop_-MSVC2008__Qt_SDK__Debug..\src\qml-box2d\box2dbody.cpp:167: error: C2065: 'M_PI' : undeclared identifier
                                      C:\Box2DDemo_v0_2\qmlbox2ddemo\box2ddemo-build-desktop-Qt_4_7_4_for_Desktop
                                      -MSVC2008__Qt_SDK__Debug..\src\qml-box2d\box2dbody.cpp:194: error: C2065: 'M_PI' : undeclared identifier
                                      C:\Box2DDemo_v0_2\qmlbox2ddemo\box2ddemo-build-desktop-Qt_4_7_4_for_Desktop
                                      -MSVC2008__Qt_SDK__Debug..\src\qml-box2d\box2dfixture.cpp:204: error: C2057: expected constant expression
                                      C:\Box2DDemo_v0_2\qmlbox2ddemo\box2ddemo-build-desktop-Qt_4_7_4_for_Desktop
                                      -MSVC2008__Qt_SDK__Debug..\src\qml-box2d\box2dfixture.cpp:204: error: C2466: cannot allocate an array of constant size 0
                                      C:\Box2DDemo_v0_2\qmlbox2ddemo\box2ddemo-build-desktop-Qt_4_7_4_for_Desktop
                                      -_MSVC2008__Qt_SDK__Debug..\src\qml-box2d\box2dfixture.cpp:204: error: C2133: 'vertices' : unknown size

                                      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