I have some cross-platform code with some C++11 features like #include <thread>
and others. I will soon be using a QNX 6.6 board, and I'm wondering if my code can compile on it, and which features will be available.
QCC is the official QNX C++ compiler, but I can't find any documentation citing which C++11 features, or even which C++ features in general, it supports. Is this a wrapper around GCC or its own thing? Either way, can I get or compile other compilers on this platform?
QNX C/C++ Project properties For projects that use managed recursive makefiles, the build settings are defined through the UI and the IDEregenerates the makefiles whenever you change these settings. Note:In past releases, such projects were called simply QNX Projects.
In the QNX Project wizard, you must select the project type in the Basic Settings. If you choose any type other than Application, you'll see the Librarytab in the QNX C/C++ Project properties after you've created the project. The Build target typeradio buttons let you select the kind of libraries to build.
From what I know qcc is just using gcc internally. Because of this you can use all functionalities provided by the version of gcc that QNX decided to put into their package. The release notes provide a link to information about gcc 4.7 but I think this link better shows which specific features are supported.
Also, you can enable code coverage through the Optionstab. You can access the QNX C/C++ Project properties in two ways:
From what I know qcc
is just using gcc
internally. Because of this you can use all functionalities provided by the version of gcc
that QNX decided to put into their package.
Judging from the release notes of QNX 6.6 gcc 4.7 is used:
The release notes provide a link to information about gcc 4.7 but I think this link better shows which specific features are supported. There is too much information on the linked page, because of that I do not copy it. But in essence the link states:
GCC provides experimental support for the 2011 ISO C++ standard. This support can be enabled with the -std=c++11 or -std=gnu++11 compiler option ... GCC's C++11 mode implements much of the C++11 standard produced by the ISO C++ committee
Whereas @Marged's answer seems to cover absolutely every important aspect of your question, I'd like to add that it is also possible to get more current versions of all GNU dev tools (like gcc, gdb or make..). This is officially provided by the QNX staff for "experimental use only", I guess1. But so far I've had only good experiences with them.
Check out QNX's updated Core Development Tools
(You need to register to the QNX community portal first to open the link)
You would then update your Linux dev system like that:
host
and the target
folder/../qnx650/host/linux/x86/etc/qcc/gcc/default
$ sudo apt-get install lib32stdc++6
$ i486-pc-nto-qnx6.5.0-g++: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
1 Official text:"Stable versions of the Core Development Tools are included as part of QNX Momentics. You can download updated versions of these tools currently being developed through this project and benefit from their enhancements earlier!"
The version of gcc that is used by qcc does support much of the C++11 specification. I've used it. Just add -std=c++11
to the compiler line.
I did find one issue with C++11 support on QNX 6.6. This was in July 2014, so things may have changed. The support of vector initialization (std::vector<int> {1,2, 3, 4};
) in the C++11 library shipped with QNX 6.6 was broken. Code would compile cleanly, but then fail rather cryptically when run. Again, I don't currently know the current status of this issue, so YMMV.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With