How do I use different compilation standards in QNX Momentics 6.5?

3.9k views Asked by At

I'm trying to build applications for the Sabre i.MX6 development board, that runs QNX OS. I'm using QNX Momentics v6.5 for cross-compiling my code. I wrote a simple "Hello World" code and I'm trying to compile it with new c standards since the project I'm working on requires that.

When I try to compile with any flag, say -std=c99 or -std=c11, it throws an error during the compilation saying

cc: unknown Option -std=c99" or "cc: unknown Option -std=c11".

I can see that the compiler it's using is gcc 4.4.2.

I'm not sure whether this version of gcc doesn't support c99 or whether the flag I'm passing is supposed to be different for QNX Momentics.

2

There are 2 answers

4
sig11 On BEST ANSWER

QNX 6.5 and gcc 4.4.2 don't support C++11. See the QCC docs for more info. The best you'll get is incomplete and experimental support through -std=c++0x or -std=gun++0x.

QNX 6.6 includes gcc 4.7.3 which does have experimental C++11 support and QNX 7.0 uses gcc 5.4.0 has full C++11 and C++14 support.

Full details of the gcc C++ standards support can be found on the gcc standards page.

1
Lubo Antonov On

QNX 6.5 doesn't support C++11 out of the box, since it is using an old GNU compiler (gcc 4.4.2). However, the QNX Software Center has several updates to QNX 6.5 that will let you update to GCC 4.8.3, which will get you pretty decent C++11 support. You will need to create an account on the QNX website and then:

  1. Download Binutils 2.24 for your host (e.g. win32-binutils-2.24.zip for WIndows) from http://community.qnx.com/sf/frs/do/listReleases/projects.toolchain/frs.binutils.
  2. Download GCC 4.8.3 for your host (e.g. win32-gcc-4.8.3-qnx65x.zip for Windows) from http://community.qnx.com/sf/frs/do/viewRelease/projects.toolchain/frs.gcc.gcc_4_8.
  3. Expand both archives - this will create host and target folders.
  4. Copy & paste new folders into QNX folder, overwrite files.
  5. Edit host/win32/x86/etc/qcc/gcc/default to change the default compiler: DIR=4.8.3

When compiling add the following flags:

  • -Vgcc_ntox86_gpp to QCC (for an x86 target) to get gcc 4.8.3 headers.
  • -Wc,-std=c++11 to QCC to make it use C++ 11.