LinuxCommandLibrary

c99

Compile C source code

TLDR

Compile source file(s) and create an executable

$ c99 [file.c]
copy

Compile source file(s) and specify the executable [o]utput filename
$ c99 -o [executable_name] [file.c]
copy

Compile source file(s) and create object file(s)
$ c99 -c [file.c]
copy

Compile source file(s), link with object file(s), and create an executable
$ c99 [file.c] [file.o]
copy

SYNOPSIS

c99 [option]... operand...

PARAMETERS

-c
    Compile only; suppress linking

-D name[=def]
    Define macro name as def (default 1)

-E
    Preprocess only; output to stdout

-g
    Produce debugging information

-I dir
    Add dir to include search path

-L dir
    Add dir to library search path

-l lib
    Link with library lib

-O [level]
    Optimization level (level optional)

-o file
    Place output in file

-s
    Strip executable of symbol table

-U name
    Undefine macro name

-ansi
    Equivalent to -std=c99; strict conformance

-std=std
    Specify standard (c99 default)

-v
    Verbose mode; show commands

-w
    Suppress all warnings

DESCRIPTION

The c99 command provides a standardized interface to compile C programs conforming to the C99 language standard (ISO/IEC 9899:1999). It invokes the system's native C compiler (often gcc or clang) with flags ensuring C99 compliance, including support for inline functions, variable-length arrays, complex numbers, and other C99 features.

Unlike generic compilers, c99 guarantees a consistent environment across POSIX-compliant systems, hiding implementation-specific details. It supports preprocessing, compilation, assembly, and linking phases, producing executables or object files. Developers use it for portable code targeting C99 without vendor extensions.

On Linux, c99 is typically a wrapper script or symlink to gcc with -std=c99. It processes source files (.c), headers (.h), and passes options like include paths or defines. Output defaults to a.out unless specified.

This utility promotes interoperability in multi-vendor environments, such as Unix-like systems, ensuring code compiles reliably under C99 rules while allowing standard optimization and debugging.

CAVEATS

Not always installed; may alias to gcc -std=c99. Extensions beyond POSIX vary by implementation. Requires C99-capable compiler.

OPERANDS

Source files (*.c), object files (*.o), libraries (*.a, *.so). Multiple operands allowed; last non-option is output if linking.

EXIT STATUS

0 on success; >0 on failure (compile/link errors).

HISTORY

Defined in POSIX.1-2001 (IEEE Std 1003.1-2001) to support ISO C99. Supersedes c89; evolved in POSIX.1-2008 with minor clarifications.

SEE ALSO

c89(1), cc(1), gcc(1), clang(1)

Copied to clipboard