Compile and link a program (GNU)

We recommend you use qcc instead of invoking gcc directly. You can use the -V option to qcc to invoke gcc. For example:
qcc -Vgcc_ntoarmle my_file.c


gcc_variant [ option | filename ]...
g++_variant [ option | filename ]...


The gcc_variant depends on the target platform, as follows:

Target platform: gcc_variant:
ARM ntoarm-gcc
x86 ntox86-gcc

The g++_variant depends on the target platform, as follows:

Target platform: g++_variant:
ARM ntoarm-g++
x86 ntox86-g++

QNX Neutrino cross-development options

-b [ntox86 | ntomips | ntoppc | ntosh]

Overall options

-c  -S  -E  -o file  -pipe  -v  -x language

C language options

-ansi  -fallow-single-precision  -fcond-mismatch  
-fno-asm  -fno-builtin  -ffreestanding  -fhosted  
-fsigned-bitfields  -fsigned-char  
-funsigned-bitfields  -funsigned-char  
-fwritable-strings  -traditional  -traditional-cpp  

C++ language options

-fall-virtual  -fdollars-in-identifiers  
-felide-constructors  -fenum-int-equiv  
-fexternal-templates  -ffor-scope  -fno-for-scope
-fhandle-signatures  -fmemoize-lookups  
-fname-mangling-version-n  -fno-default-inline  
-fno-gnu-keywords -fnonnull-objects -fguiding-decls
-foperator-names  -fstrict-prototype  -fthis-is-variable
-ftemplate-depth-n  -nostdinc++  -traditional  +en

Warning options

-fsyntax-only  -pedantic  -pedantic-errors
-w  -W  -Wall  -Waggregate-return  
-Wbad-function-cast  -Wcast-align  -Wcast-qual  
-Wchar-subscript  -Wcomment  -Wconversion  -Werror  
-Wformat  -Wid-clash-len  -Wimplicit -Wimplicit-int 
-Wimplicit-function-declarations -Wimport  -Winline
-Wlarger-than-len  -Wmain  -Wmissing-declarations
-Wmissing-prototypes  -Wnested-externs
-Wno-import  -Wold-style-cast  -Woverloaded-virtual  
-Wparentheses  -Wpointer-arith  -Wredundant-decls  
-Wreorder  -Wreturn-type  -Wshadow  -Wsign-compare  
-Wstrict-prototypes  -Wswitch  -Wsynth
-Wtemplate-debugging  -Wtraditional  -Wtrigraphs
-Wundef  -Wuninitialized  -Wunused  -Wwrite-strings

Debugging options

-a  -ax  -dletters  -fpretend-float
-fprofile-arcs  -ftest-coverage
-g  -glevel  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  
-gdwarf-2  -ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+
-p  -pg  -print-file-name=library  
-print-libgcc-file-name  -print-prog-name=program  
-print-search-dirs  -save-temps

QNX extension:


Optimization options

-fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
-fdelayed-branch   -fexpensive-optimizations
-ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
-ffunction-sections  -finline-functions
-fkeep-inline-functions  -fno-default-inline
-fno-defer-pop  -fno-function-cse
-fno-inline  -fno-peephole  -fomit-frame-pointer
-frerun-cse-after-loop  -fschedule-insns
-fschedule-insns2  -fstrength-reduce  -fthread-jumps
-funroll-all-loops  -funroll-loops
-O  -O0  -O1  -O2  -O3

Preprocessor options

-Aquestion(answer)  -C  -dD  -dM  -dN
-Dmacro[=defn]  -E  -H
-idirafter dir
-include file  -imacros file
-iprefix file  -iwithprefix dir
-iwithprefixbefore dir  -isystem dir
-M  -MD  -MM  -MMD  -MG  -nostdinc  -P  -trigraphs
-undef  -Umacro  -Wp,option

Assembler option


Linker options

object-file-name  -llibrary
-nostartfiles  -nodefaultlibs  -nostdlib
-s  -static  -shared  -symbolic
-Wl,option  -Xlinker option
-u symbol

Directory options

-Bprefix  -Idir  -I-  -Ldir  -specs=file

Target options

-b machine  -V version

Machine-dependent options

PowerPC options:

-mcpu=cpu type
-mtune=cpu type
-mpower  -mno-power  -mpower2  -mno-power2
-mpowerpc  -mno-powerpc
-mpowerpc-gpopt  -mno-powerpc-gpopt
-mpowerpc-gfxopt  -mno-powerpc-gfxopt
-mnew-mnemonics  -mno-new-mnemonics
-mfull-toc   -mminimal-toc  -mno-fop-in-toc  
-mno-sum-in-toc  -mxl-call  -mno-xl-call  -mthreads  
-mpe -msoft-float  -mhard-float  -mmultiple  
-mno-multiple  -mstring  -mno-string  -mupdate  
-mno-update  -mfused-madd  -mno-fused-madd  
-mbit-align  -mno-bit-align
-mstrict-align  -mno-strict-align  -mrelocatable
-mno-relocatable  -mrelocatable-lib  
-mtoc  -mno-toc  -mtraceback  -mno-traceback
-mlittle  -mlittle-endian  -mbig  -mbig-endian
-mcall-aix  -mcall-sysv  -mprototype  -mno-prototype
-msim  -mmvme  -mads  -myellowknife  -memb
-msdata  -msdata=opt  -G num

i386 options:

-mcpu=cpu type
-march=cpu type
-mieee-fp  -mno-fancy-math-387
-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib
-mno-wide-multiply  -mrtd  -malign-double
-mreg-alloc=list  -mregparm=num
-malign-jumps=num  -malign-loops=num

Code-generation options

-fcall-saved-reg  -fcall-used-reg
-ffixed-reg  -finhibit-size-directive
-fcheck-memory-usage  -fprefix-function-name
-fno-common  -fno-ident  -fno-gnu-linker
-fpcc-struct-return  -freg-struct-return
-fshared-data  -fpic  -fPIC  -fexceptions
-fshort-enums  -fshort-double  -fvolatile  
-fvolatile-global  -fverbose-asm  -fpack-struct  
-fstack-check  +e0  +e1
  • If you use exceptions, you must link with the -lang-c++ option to qcc . This option is the default for QCC.

    Even with exceptions disabled, the default new() operator throws a std::out_of_memory exception if there isn't enough memory. If you want new() to return NULL instead of throwing an exception, overload the new() operator with your own.

QNX Neutrino extension:

Prevent the code generator from using floating point registers to move integers. Using floating point registers for this is very slow on systems that use floating point emulation.


We recommend you use qcc or QCC instead of gcc to compile and link your programs.

For detailed documentation about gcc, see the GNU website at http://www.gnu.org/ .

If you have trouble using the default debug format (-gdwarf), switch to -gdwarf-2 or -gstabs.

Exit status:

A nonfatal compilation error was encountered.
A fatal compilation error was encountered.
Unable to open a required file.

Contributing author: