Can I use C ++ 11 in QNX?

I have cross-platform code with some C ++ 11 features like #include <thread> and others. I will be using QNX 6.6 soon, and I wonder if my code will be able to compile it and what features will be available.

QCC is the official QNX C ++ compiler, but I can’t find the documentation that lists those C ++ 11 features, or even that generally support C ++. Is it a wrapper around GCC or its own stuff? In any case, can I get or compile other compilers on this platform?

+5
source share
3 answers

From what I know, qcc just uses gcc internally. Because of this, you can use all the functions provided by the gcc version that QNX decided to put in its package.

Judging by the QNX 6.6 release notes , gcc 4.7 is used:

  • GCC 4.7 toolchain, including support for Intel Advanced Vector Extensions (AVX).
  • Gdb 7.5
  • New: Binutils 2.24
  • Python 2.7.5 as a tool for the host

The release notes contain a link to gcc 4.7 info, but I think this link better shows which specific features are supported. There is too much information on the linked page, so I don’t copy it. But essentially the link indicates:

GCC provides experimental support for the 2011 ISO C ++ standard. This support can be enabled using the -std = C ++ 11 or -std = gnu ++ 11 option ... GCC C ++ 11 mode implements most of the C ++ 11 standard created by the ISO C ++ Committee

+7
source

While the @Marged answer seems to cover absolutely all the important aspects of your question, I would like to add that you can also get more current versions of all GNU dev tools (like gcc, gdb or make ..). This is officially provided by QNX staff for “experimental use,” I think 1 . But so far I have only had good experience with them.

Check out the updated QNX Core Development Tools

(You must first register on the QNX community portal to open the link)

enter image description here

Then you would upgrade your Linux dev system as follows:

  • Get files from here
    • Binutils
    • NCA
  • Extract the files to a new folder (do not extract or overwrite the existing folder directly, as it may be that symbolic links are not updated)
    • which should create the host and target folder
  • Copy and paste the new files into the actual QNX folder and overwrite the existing files.
  • Optional: update the default configuration file value for the new compiler version
    • eg. /../qnx650/host/linux/x86/etc/qcc/gcc/default
  • make sure that 32-bit libraries are installed (if not):
    • $ sudo apt-get install lib32stdc++6
    • if the correct errors are not installed, for example the following: $ 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 with QNX Momentics. You can download updated versions of these tools currently being developed as part of this project and use their enhancements earlier!"

+6
source

The gcc version used by qcc supports most of the C ++ 11 specification. I used it. Just add -std=c++11 to the compiler line.

I found one problem with C ++ 11 support in QNX 6.6. It was in July 2014, so everything could change. Support for vector initialization was broken ( std::vector<int> {1,2, 3, 4}; ) in the C ++ 11 library that ships with QNX 6.6. The code will compile in a clean way, but then, when launched with an error, it will look rather mysterious. Again, I do not know the current status of this problem, therefore YMMV.

+3
source

Source: https://habr.com/ru/post/1237703/


All Articles