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
Posts: 42
Registered: ‎02-17-2012
My Device: Newb Playbook Developer
My Carrier: -
Accepted Solution

Adding library to linker in BB10

Hi, i'm having trouble linking a library to my project. Previously, I was working on the playbook ndk and it let me make managed build as opposed to the bb10 ndk that apparently only allows makefile build. So I tried to decrypt the makefiles to figure out where to make the appropriate changes and it turns that the makefile.debug contains the linker command, but it seems that the makefile itself is automatically generated and so I can't directly append a -lsqlite3 to the command. If anyone can help me out with this it would be terrific. 

Developer
Posts: 137
Registered: ‎09-30-2009
My Device: Torch 9800

Re: Adding library to linker in BB10

I am confused too. I want to add curl to my cascades project. I use the Cofigure->Add Library then BlackBerry library and select curl from there. Then it tells me to add the option in the makefile lwith -l option. How to do that? I am transferring from java to c. so a lot of things are not clear. It would be great if you could help us out. Also an overall idea about the c++ programming system in qnx tutorial or something like it would be great.
----------------------
Press like if you find a message helpful
---------
Highlighted
Contributor
Posts: 33
Registered: ‎04-26-2010
My Device: Z10 / PlayBook 16GB
My Carrier: Verizon

Re: Adding library to linker in BB10

I'm not sure if this is the "preferred" way to do this, but I found out a way to do it

 

In your Project properties, go to

C/C++ Build -> Environment 

 

At the top choose Configurations -> [All configurations]

 

Then click "Add..."

 

then you can add the new variable

name:  SUBLIBS

value: -lsqlite3 -lcurl

 

this SUBLIBS variable is automatically prepended to the libs when you build the project, so you can add any libraries here on this line

 

Mine looks like this after defining the new variable:

Screen Shot 2012-05-13 at 11.18.29 AM.png

 

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Adding library to linker in BB10

[ Edited ]

harshalbid271 wrote:

Hi, i'm having trouble linking a library to my project. Previously, I was working on the playbook ndk and it let me make managed build as opposed to the bb10 ndk that apparently only allows makefile build. ...


I'm using BB10 NDK + Cascades and I could use Managed Build:

managed_build.png

curious why you don't have these options ?

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Adding library to linker in BB10

[ Edited ]

I also have some problems using a library with BB10/Cascades

see my thread "Include from Library project" in this forum

--edited--

solved my issue there - reason was an empty /src folder

--

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 137
Registered: ‎09-30-2009
My Device: Torch 9800

Re: Adding library to linker in BB10

@jamespaulmuir your trick solved my linker issues. Thank you very much.

@ekke did not try your system yet.
----------------------
Press like if you find a message helpful
---------
Contributor
Posts: 42
Registered: ‎02-17-2012
My Device: Newb Playbook Developer
My Carrier: -

Re: Adding library to linker in BB10

Thanks for the help Smiley Happy  Although I did figure it out after spending a lot of time on it.