Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
delcasda
Posts: 39
Registered: ‎05-24-2011
My Device: playbook
My Carrier: vodafone
Accepted Solution

Box2D setup

Hi,

 

anybody can explain how comes if I am including all box2D libraries I get undefined references for example for b2World but not for b2Vec2 or b2BodyDef as shown on screenshot?

Screenshot1

Please use plain text.
BlackBerry Development Advisor (Retired)
dtomilovskiy
Posts: 36
Registered: ‎10-26-2011
My Device: RIM Developer
My Carrier: Rogers

Re: Box2D setup

So, you have box2d headers but you dont link box2d library to you project. There are a couple of things you need to do to make this work properly.

 

Go to your Properties->Project References tab. Add box2d as a reference, this will cause box2d to be built before your project is built.

 

Then go to Properties->C/C++ Build->Settings tab.

 

Under QCC Compiler->Preprocessor add :

"${workspace_loc:/box2d}"

 

Under QCC Linker->Libraries Library Paths(-L) box :

"${workspace_loc:/box2d/Device-Debug}"
"${workspace_loc:/box2d/arm/a-le-v7}"

 

And in Libraries(-l) box in the same tab add :

box2d

 

This should do the trick. And take a look at BelligerentBlocks sample on the github. It is a C++ project that uses box2d.

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Box2D setup

Hi,

 

Not sure what in the environment may be causing this but try the following:

1) import the Box2D project to your workspace and build (looks like you've already done this)

2) Import the HelloWorld sample directly from the Box2D project

   a) File > Import > General > Existing Projects Into Workspace

   b) In the file explorer browse to the HelloWorld folder within the Box2D project and import

   c) Build

 

This will ensure everything it set up correctly. Let me know if you experience any further issues.

 

Cheers,

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
BlackBerry Development Advisor (Retired)
cdamus
Posts: 45
Registered: ‎10-25-2010
My Device: Bold 9700
My Carrier: Rogers

Re: Box2D setup

Hi,

Since NDK 2.0 Beta 3, there is a new "Add Library" wizard that sets up all these details for you in one easy step. Just select the application project, hit Ctrl+Shift+L (Command+Shift+L on Mac), choose the "Library Project in the Workspace" option, then pick the box2D project and finish the wizard.

HTH,

Christian
Please use plain text.
Contributor
delcasda
Posts: 39
Registered: ‎05-24-2011
My Device: playbook
My Carrier: vodafone

Re: Box2D setup

Hi Garett,

 

your solution works perfect on NDK 1.0 but on NDK 2.0 build is ok but run as fails with "

Packaging failed:1

Error: File or dir does not exist: C:\bbndk-2.0.0-beta3\target\target-override\armle-v7\usr\lib\libbps.so"

 

I am trying to add "C:\bbndk-2.0.0-beta3\target\qnx6\armle-v7\usr\lib" where I can see the file is but I am not really godd setting it up.

I keep trying.

Thanks

Please use plain text.
BlackBerry Development Advisor (Retired)
dtomilovskiy
Posts: 36
Registered: ‎10-26-2011
My Device: RIM Developer
My Carrier: Rogers

Re: Box2D setup

Problem here is that you have a bar-descriptor tries to package libbps with the app. Go to your bar-descriptor.xml and remove this line:

 

<asset

path="${QNX_TARGET}\..\target-override\armle-v7\usr\lib\libbps.so.1"type="Qnx/Elf">lib/libbps.so.1</asset>

 

You dont need to do this in NDK2.0. Also, there is a 2.0 branch of samples on github.

Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Box2D setup

[ Edited ]

Update: The above post dtomilovskiy explains this correctly, you can just remove reference to the libbps.so from the bar-descriptor file.

 

Regards,

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.