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
New Developer
EldarBB
Posts: 7
Registered: ‎06-15-2012
My Device: Blackberry 10 Dev
My Carrier: 07947925382

C++11

I have been itching to use some of the C++11 features for quite some time now, and I was glad to find out that QNX SDK uses gcc 4.6.3, which supports some of its features including "auto". However compiling cascades app with it failed, because it's not on by default. I tried adding -std=c++11 flag to the .pro file, but that didn't work, because it uses qcc driver instead of gcc and it doesn't seem to have this feature. Is there a flag to switch it on? 

Please use plain text.
BlackBerry Development Advisor (Retired)
danielrr5
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: C++11

Try -Wc,-std=c++0x

Please use plain text.
BlackBerry Development Advisor (Retired)
danielrr5
Posts: 32
Registered: ‎05-09-2012
My Device: BB10
My Carrier: None

Re: C++11

Hi EldarBB, have you had a chance to try this yet?

Thanks!
Daniel
Please use plain text.
New Developer
EldarBB
Posts: 7
Registered: ‎06-15-2012
My Device: Blackberry 10 Dev
My Carrier: 07947925382

Re: C++11

[ Edited ]

Hi Daniel,

 

Sorry it took me so long to get back, I have tried it and it failed on the next step, in qlist.h there is an include statement:

#include <initializer_list>

And it couldn't find this header. 

I can see the header here: <SDK>/target/qnx6/usr/include/c++/4.6.3/initializer_list but obviously it's not picked up. I suspect that by default it uses headers from this location <SDK>/target/qnx6/usr/include/cpp . I added this directory to the include path, but I got the next problem:

 

/Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/usr/include/c++/4.6.3/utility:69:28: fatal error: bits/c++config.h: No such file or directory

 

So I have to fix that by adding the following lines to the .pro file(I'm on Mac):

INCLUDEPATH += /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/usr/include/c++/4.6.3

INCLUDEPATH += /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/usr/include/c++/4.6.3/i486-pc-nto-qnx8.0.0

 

Is there a way to make that not platform specific?


Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha
My Carrier: none

Re: C++11

Hi,

 

the bits/c++config.h file is platform specific, that's why it is hidden in the i486-pc-nto-qnx8.0.0 folder. Normally the default compiler should find this automatically but I suspect you may need to have to either create a new QCC config setting (Project Properties->c++ build->environment->QCC_CONF_PATH) and configure all of that for proper c++11 compilation.

 

(But that kind of defeats the purpose of having something non-platform specific I guess)

 

For now you may have to stick with

 

$(QNX_TARGET)/usr/include/c++/4.6.3

 

in your .pro file.

 

Cheers

Selom

Please use plain text.
New Developer
EldarBB
Posts: 7
Registered: ‎06-15-2012
My Device: Blackberry 10 Dev
My Carrier: 07947925382

Re: C++11

Thanks, that's useful. But it's quite limited, because the runtime doesn't seem to support C++11. For example when I tried to use std::function I got linking errors.
Please use plain text.
BlackBerry Development Advisor
doturner
Posts: 35
Registered: ‎10-15-2013
My Device: BlackBerry Z30
My Carrier: O2 UK

Re: C++11

Yes, unfortunately it's not yet possible to use C++11 library features with a Cascades app. More here if you're interested: http://supportforums.blackberry.com/t5/Native-Development/C-11-and-BlackBerry-10/m-p/2985632
Please use plain text.