1. hoangbv15's Avatar
    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
    07-17-20 05:08 PM
  2. Simo_Dax's Avatar
    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 devs
    07-17-20 06:00 PM
  3. hoangbv15's Avatar
    Hey there!
    It's always nice to see people getting on board
    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 devs
    Hi Simo, thank you for replying! This forum is great, the only downside is the long wait for approval when posting.

    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 AM
  4. brookie229's Avatar
    long wait for approval when posting.
    That wait goes away after you've completed a minimum number of posts (20, I believe? - someone here will correct me if I'm wrong).
    07-19-20 08:18 AM
  5. hoangbv15's Avatar
    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 AM
  6. Simo_Dax's Avatar
    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 think that QTEST_CASCADES_MAIN is used to replace the standard main function when you want to run tests instead of the app. This would also explain how qmake decides which code to build
    I've never used that functionality though, I may be wrong
    07-20-20 02:26 AM
  7. hoangbv15's Avatar
    I think that QTEST_CASCADES_MAIN is used to replace the standard main function when you want to run tests instead of the app. This would also explain how qmake decides which code to build
    I've never used that functionality though, I may be wrong
    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 AM
  8. Simo_Dax's Avatar
    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?
    It would indeed, but it may be your only option

    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 tests
    07-20-20 12:49 PM
  9. hoangbv15's Avatar
    It would indeed, but it may be your only option

    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 tests
    I just found out that not only you need to comment out code/define symbols to switch between normal and test builds, you also can't have more than 1 test class. There is a way to make it run multiple tests as shown here
    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 PM
  10. m3mb3rsh1p's Avatar
    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?

    ...

    Best,
    Hoang
    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.

    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 PM
  11. hoangbv15's Avatar
    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.
    I hope there exists that someone willing to modernise this platform with the latest C++ and Qt
    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 AM
  12. Chuck Finley69's Avatar
    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
    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...
    07-30-20 08:22 PM
  13. hoangbv15's Avatar
    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...
    Oh yes, this forum is definitely one of the places I search through to look for BB10 dev resources.
    Thank you for the warm welcome!
    07-31-20 04:48 PM
  14. hoangbv15's Avatar
    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.
    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.
    07-31-20 04:55 PM
  15. Leyra B10's Avatar
    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.
    That would be pretty cool. Wanted to try something like this with a graph structure and javascript 'mixins' or 'extend' to glue some native functionality to the web views.

    Posted via CB10
    08-04-20 02:28 AM
  16. DonHB's Avatar
    Is anyone here familiar with the tools described here (c++11)?

    https://www.didacticode.ca/blog/deve...blackberry-10/
    07-25-21 01:17 PM
  17. Dunt Dunt Dunt's Avatar
    Is anyone here familiar with the tools described here (c++11)?

    https://www.didacticode.ca/blog/deve...blackberry-10/
    Was a rather new post....

    I'd suggest you contact him https://extrowerk.com/contact/
    07-26-21 11:49 AM
  18. DidactiCOde-leo's Avatar
    Is anyone here familiar with the tools described here (c++11)?

    https://www.didacticode.ca/blog/deve...blackberry-10/
    Hi. I made those tools and I'm glad you're interested in trying them out. I haven't worked on them in quite some time, but they should still be functional. You can use them to compile c/c++ programs from the command line, and they only require average knowledge of development tools like make, sh etc.

    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 AM
  19. DonHB's Avatar
    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-token
    07-29-21 12:17 PM
  20. DidactiCOde-leo's Avatar
    [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-tokens
    Last edited by DidactiCOde-leo; 07-29-21 at 03:20 PM.
    Dunt Dunt Dunt likes this.
    07-29-21 01:18 PM
  21. DonHB's Avatar
    Do you know if Momentics works on macOS Big Sur?
    08-06-21 11:47 PM
  22. DidactiCOde-leo's Avatar
    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 AM
  23. DonHB's Avatar
    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.

    .
    Can this method be used for porting C++11 code for background apps?
    10-06-21 02:28 PM

Similar Threads

  1. A Question For The Holdouts
    By claytonknight in forum New to the Forums? Introduce Yourself Here!
    Replies: 95
    Last Post: 10-29-21, 08:15 AM
  2. New Handsets
    By Alugi in forum BlackBerry KEY2
    Replies: 22
    Last Post: 07-23-20, 10:22 AM
  3. Hello BB10 Revival
    By Nova11 in forum New to the Forums? Introduce Yourself Here!
    Replies: 5
    Last Post: 07-16-20, 05:19 AM
  4. Start Your Career in Game Design and Development With 24 Hours of Training for $30
    By CrackBerry News in forum CrackBerry.com News Discussion & Contests
    Replies: 0
    Last Post: 07-15-20, 08:12 PM
  5. My brand new BlackBerry Z30
    By cb4chris in forum BlackBerry Z30
    Replies: 3
    Last Post: 07-14-20, 04:24 AM
LINK TO POST COPIED TO CLIPBOARD