- Hi everyone,
Hopefully I can attract the attention of the few active BB10 devs left here.
With the provided Momentics IDE 2.1.2, do you guys know if the QCC provided supports the latest C++17? What about C++20? Is there any chance it can happen?
The last time I did C++ was perhaps a decade ago. Coming back from .net and the like, modern-day convenience such as string interpolation is so difficult in C++. Anyone knows a good way to do string format, or string building in C++, to avoid string concatenation?
Also is there a community such as discord or any other medium of active BB10 devs? Or are we just some lonely people?
Best,
Hoang07-17-20 05:08 PMLike 0 - Hey there!
It's always nice to see people getting on board
The native sdk is based on Qt 4.8, as such its compiler only supports c++98 (heh..).
Luckily there are convenience classes embedded in Qt which replace and extend the std/stl libraries, in your case QString (https://doc.qt.io/archives/qt-4.8/qstring.html) will do the trick I think. You don't even have to explicitly wrap the constructor around string literals, for instance you can write "hello " + name + "!" and that's it.
In my experience, the only time I had to resort to the std libraries was to parse strings containing emojis and I needed an utf-32 representation, for everything else Qt libraries have been really convenient and well integrated in the sdk
I hope I answered to your question
EDIT: I think this forum is the best way to get in touch with the community, i'm not aware of any slack or discord for devs07-17-20 06:00 PMLike 0 -
I also discovered QString when trying to turn a number into a string (although I am unsure if that's the best way).
Having looked at the qstring documentation for .append and +=, this seems like the way to go.
This operation is typically very fast (constant time), because QString preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.Last edited by hoangbv15; 07-19-20 at 08:08 AM.
07-19-20 05:51 AMLike 0 -
- Now that I've found some people here, let me ask another question:
I've been following the tutorial to add unit tests using qTest, but I feel that there's not enough hand holding
https://developer.blackberry.com/nat..._qtestlib.html
I'm stuck at the point where I need to include the test headers and the macro QTEST_CASCADES_MAIN in main.cpp. However I am obviously missing something here, as that macro will add another main function to main.cpp, resulting in a compilation error. In the github sample project provided by that document, there is no blackberry app. It's just one main.cpp with tests so it's not exactly helpful.
I also don't quite understand how qmake will know to exclude the test code from the main build, as there doesn't seem to be any indicator or marker in code. Everything seems to just be in one project with no clear separation.
EDIT: It seems I am able to instantly post now! Thanks to whoever decided to lift the restriction for my account!07-19-20 11:31 AMLike 0 - Now that I've found some people here, let me ask another question:
I've been following the tutorial to add unit tests using qTest, but I feel that there's not enough hand holding
https://developer.blackberry.com/nat..._qtestlib.html
I'm stuck at the point where I need to include the test headers and the macro QTEST_CASCADES_MAIN in main.cpp. However I am obviously missing something here, as that macro will add another main function to main.cpp, resulting in a compilation error. In the github sample project provided by that document, there is no blackberry app. It's just one main.cpp with tests so it's not exactly helpful.
I also don't quite understand how qmake will know to exclude the test code from the main build, as there doesn't seem to be any indicator or marker in code. Everything seems to just be in one project with no clear separation.
EDIT: It seems I am able to instantly post now! Thanks to whoever decided to lift the restriction for my account!
I've never used that functionality though, I may be wrong07-20-20 02:26 AMLike 0 - You may be right, but I can't figure out how exactly it replaces the standard main function. As soon as you put that macro in, the compiler immediately complains that there are more than 1 main functions. It would be silly to have to comment out code every time you run tests, wouldn't it?07-20-20 05:25 AMLike 0
- You may be right, but I can't figure out how exactly it replaces the standard main function. As soon as you put that macro in, the compiler immediately complains that there are more than 1 main functions. It would be silly to have to comment out code every time you run tests, wouldn't it?
To make the pill a bit easier to swallow you could #define a symbol and use #ifdef to make the two main mutually exclusive, so that you just need to comment the one define line to switch between app and tests07-20-20 12:49 PMLike 0 -
But the IDE would only show the result from the last one.
The pill is hard to swallow indeed.
What I think I will try to find out next is to define a test symbol for the unit test launch configuration, so at least the commenting/uncommenting will not need doing. Eclipse is making it hard though, have not managed to find that option.07-21-20 03:51 PMLike 0 -
As mentioned, the default compiler in Momentics is gcc-4.6 which is used to compile and (more importantly) link Qt 4.8 to the C++98 standard. BlackBerry also includes gcc-4.8.2 which supports C++11. Unfortunately, C++11 cannot be used to compile (and link) with Cascades directly because it wasn't until Qt 5 that C++11 and its incompatible ABI changes were supported in Qt.
It is possible, however, to write C++11 code that uses the base QNX libraries in a separate project and then export C functions using "extern "C"" that can be used by other Cascades projects. Conceivably, you could do this to program your core logic using modern C++11 features, use Cascades for the UI and other facilities in a separate project, then link the two using a "C glue". It does take a bit of tinkering to modify the compiler flags in Momentics, though.
Newer C++ versions would require building a recent version of gcc. It "might" be possible, but configuring gcc for a specialized platform like QNX is no easy task. We already have the configuration files, linker scripts and compiler flags used to build the included gcc-4.8, so someone with the knowledge, time and patience should have a decent starting point to build a recent gcc.
C++11 contains "most" of the new changes to C++ whereas later versions improved upon or refined them, whilst enhancing the standard library. As such, the included gcc-4.8.2 should be enough to realize the paradigm shift of modern C++ in BB10.
With that in mind, I would suggest taking a look at fmtlib which will be added to C++20 as the standard string formatting library in C++. It has been around for a few years and compiles with C++11. version 4.x of fmtlib also supports C++98 so it can be compiled and linked with Cascades.
Qt's QString is definitely as advanced, if not more so, than fmtlib so I would agree that it should be the preferred method of string formatting/manipulation in Cascades. If you do use gcc-4.8 to write C++11 code, then fmtlib would provide similar functionality to you where QString is unavailable due to the ABI incompatibility.
All the best.07-29-20 09:48 PMLike 0 - Newer C++ versions would require building a recent version of gcc. It "might" be possible, but configuring gcc for a specialized platform like QNX is no easy task. We already have the configuration files, linker scripts and compiler flags used to build the included gcc-4.8, so someone with the knowledge, time and patience should have a decent starting point to build a recent gcc.
Eventually I settled for QString. I'm also learning the basics of Qt and found it quite helpful in a lot of ways. For instance, linking a network reply back to its original request. Things I took for granted with modern .net and others.
I surely hope you do intent to maintain this hobby, I just started and certainly don't want this community to wither!
Thank you very much for the detailed response!07-30-20 03:38 AMLike 0 - Hi everyone,
Hopefully I can attract the attention of the few active BB10 devs left here.
With the provided Momentics IDE 2.1.2, do you guys know if the QCC provided supports the latest C++17? What about C++20? Is there any chance it can happen?
The last time I did C++ was perhaps a decade ago. Coming back from .net and the like, modern-day convenience such as string interpolation is so difficult in C++. Anyone knows a good way to do string format, or string building in C++, to avoid string concatenation?
Also is there a community such as discord or any other medium of active BB10 devs? Or are we just some lonely people?
Best,
Hoang
I’m usually absent from real threads like this because I’m not a developer of any sorts...
However, I thought I should politely suggest to search through many of threads under the BB10 forums. There are several that are involved with several aspects of BB10 development hobbyist culture that I’m sure you’d enjoy friending here... Good luck
Back to my usual mayhem...07-30-20 08:22 PMLike 0 - Welcome to CrackBerry!!!! Post early and post often.....
I’m usually absent from real threads like this because I’m not a developer of any sorts...
However, I thought I should politely suggest to search through many of threads under the BB10 forums. There are several that are involved with several aspects of BB10 development hobbyist culture that I’m sure you’d enjoy friending here... Good luck
Back to my usual mayhem...
Thank you for the warm welcome!07-31-20 04:48 PMLike 0 - It is possible, however, to write C++11 code that uses the base QNX libraries in a separate project and then export C functions using "extern "C"" that can be used by other Cascades projects. Conceivably, you could do this to program your core logic using modern C++11 features, use Cascades for the UI and other facilities in a separate project, then link the two using a "C glue". It does take a bit of tinkering to modify the compiler flags in Momentics, though.
The thing I am hoping for though, is a way to create shared libraries that can be reused across different BB10 projects. Easiest way is probably through symbolic links lol.07-31-20 04:55 PMLike 0 - Apologies, I only have the time to properly read through everything on this fine Friday evening. This does sound both promising and detrimental. Tinkering with compiler flags and linkage is not what I'd consider doing as someone who has just returned to C++ in a decade. Losing QString and potentially other Qt goodies is not very good as well.
The thing I am hoping for though, is a way to create shared libraries that can be reused across different BB10 projects. Easiest way is probably through symbolic links lol.
Posted via CB1008-04-20 02:28 AMLike 0 - Is anyone here familiar with the tools described here (c++11)?
https://www.didacticode.ca/blog/deve...blackberry-10/07-25-21 01:17 PMLike 0 - Is anyone here familiar with the tools described here (c++11)?
https://www.didacticode.ca/blog/deve...blackberry-10/
I'd suggest you contact him https://extrowerk.com/contact/07-26-21 11:49 AMLike 0 - Is anyone here familiar with the tools described here (c++11)?
https://www.didacticode.ca/blog/deve...blackberry-10/
Unfortunately, BlackBerry10 dev servers seem to have been updated to a newer security standard so you cannot use their new bbid tokens generated by the developer website to create debug tokens or sign apps using the Momentics ndk tools... until someone figures out how to reconfigure local tools to decrypt them using newer standards. I suggest you post a BlackBerry-tagged message on Stack Overflow to alert them. BlackBerry developers seem to check those posts frequently enough.
I will be getting back to this work soon, but until then, please try and see what you can do with the tools on your own. I learnt a lot about BB10 architecture and POSIX development in general, while figuring everything out and I'm sure you will enjoy refreshing your skills as well.
All the best.app_Developer likes this.07-28-21 10:36 AMLike 1 - BlackBerry claims to have resolved the debug token issue would this extend to signing of apps? have not had a chance to check myself:
https://stackoverflow.com/questions/...te-debug-token07-29-21 12:17 PMLike 0 - [revised]
I posted a question on Stack Overflow and discovered that my problem was of my own doing. BlackBerry's response was immediate and I was able to get a token from a fresh Momentics install in Windows. Sorry for the confusion; I really was having a problem creating a new bbid token and had "tried everything (TM)"
https://stackoverflow.com/questions/...ew-bbid-tokensLast edited by DidactiCOde-leo; 07-29-21 at 03:20 PM.
Dunt Dunt Dunt likes this.07-29-21 01:18 PMLike 1 - I don't know. I would assume it does, because the hardware requirements for Big Sur set Mavericks as the baseline.08-09-21 04:10 AMLike 0
- Hi. I still do a bit of hobby coding on BB10. I haven't released any apps, but I hope to do so because BB10 is still my favourite OS.
It is possible, however, to write C++11 code that uses the base QNX libraries in a separate project and then export C functions using "extern "C"" that can be used by other Cascades projects. Conceivably, you could do this to program your core logic using modern C++11 features, use Cascades for the UI and other facilities in a separate project, then link the two using a "C glue". It does take a bit of tinkering to modify the compiler flags in Momentics, though.
Newer C++ versions would require building a recent version of gcc. It "might" be possible, but configuring gcc for a specialized platform like QNX is no easy task. We already have the configuration files, linker scripts and compiler flags used to build the included gcc-4.8, so someone with the knowledge, time and patience should have a decent starting point to build a recent gcc.
C++11 contains "most" of the new changes to C++ whereas later versions improved upon or refined them, whilst enhancing the standard library. As such, the included gcc-4.8.2 should be enough to realize the paradigm shift of modern C++ in BB10.
.10-06-21 02:28 PMLike 0
- Forum
- BlackBerry 10 Phones & OS
- BlackBerry 10 Apps
New BB10 developer here - question about C++17
Similar Threads
-
A Question For The Holdouts
By claytonknight in forum New to the Forums? Introduce Yourself Here!Replies: 95Last Post: 10-29-21, 08:15 AM -
New Handsets
By Alugi in forum BlackBerry KEY2Replies: 22Last Post: 07-23-20, 10:22 AM -
Hello BB10 Revival
By Nova11 in forum New to the Forums? Introduce Yourself Here!Replies: 5Last Post: 07-16-20, 05:19 AM -
Start Your Career in Game Design and Development With 24 Hours of Training for $30
By CrackBerry News in forum CrackBerry.com News Discussion & ContestsReplies: 0Last Post: 07-15-20, 08:12 PM -
My brand new BlackBerry Z30
By cb4chris in forum BlackBerry Z30Replies: 3Last Post: 07-14-20, 04:24 AM
LINK TO POST COPIED TO CLIPBOARD