GCC

Cheat on the GNU Compile Collection (GCC) language extensions and command line utilities.

  1. main.c: main gcc cheat
  2. Introduction
  3. Compilation steps
  4. gcc utility
    1. Spec files
  5. cpp
  6. Internals
    1. Build and install
    2. Source tree

Scope

This will only cover C specifics. Generic ELF manipulation tools like ld (which can work across any language) are not included.

Cross compile

Cross compiling means to compile a program for a different OS or architecture than the one the compiler is running.

GCC cannot cross compile for windows from Linux (TODO check).

This can be done with MinGW (TODO how).

Infamous error messages

Error messages that are difficult to interpret for newbs:

  • struct has incomplete type = struct undefined. You forgot to include some header.