(C++) Compiler

January 3, 2018 · View on GitHub

A compiler is a program that translates your C++ code to object code, after which it is linked (by the linker) to an executable.

A compiler might emit compile warnings and compile errors.  

Qt Creator How to use Qt Creator to compile C code?

In the project file, add the following lines:

QMAKE_CXX = gcc
QMAKE_CXXFLAGS = -x c

 

Qt Creator How to set the C compiler to the C99 standard in Qt Creator?

In the project file, add the following lines:

QMAKE_C = gcc
QMAKE_CFLAGS = -x c -std=c99

Advice

  • Ideally, a program should be statically type safe [5]
  • Compile cleanly at high warning levels [1,3]
  • Prefer compile errors to runtime errors [2,4]

References