LinuxCommandLibrary

c99

POSIX-standard C99 compiler interface

TLDR

Compile a C source file to an executable

$ c99 [file.c] -o [output]
copy
Compile without linking (produce object file)
$ c99 -c [file.c]
copy
Compile with a library
$ c99 [file.c] -l[library] -o [output]
copy
Define a preprocessor macro
$ c99 -D [NAME=value] [file.c] -o [output]
copy
Add include directory for headers
$ c99 -I [path/to/includes] [file.c] -o [output]
copy
Compile with optimization
$ c99 -O [file.c] -o [output]
copy

SYNOPSIS

c99 [-c] [-D name[=value]...] [-E] [-g] [-I directory...] [-L directory...] [-o outfile] [-O optlevel] [-s] [-U name...] operand...

DESCRIPTION

c99 is the POSIX-standard interface to the C compilation system for compiling C99-conformant source code. It compiles C source files and links them to produce an executable file, or can produce object files for later linking.
The command accepts source files (.c), object files (.o), and library archives (.a) as operands. Without the -o option, the executable is written to a.out.

PARAMETERS

-c

Compile only; do not link. Produces object files (.o)
-D name[=value]
Define preprocessor macro
-E
Preprocess only; do not compile
-g
Include debugging information
-I directory
Add directory to header search path
-L directory
Add directory to library search path
-l library
Link with specified library
-o outfile
Write output to specified file
-O optlevel
Enable optimization (0, 1, 2, 3)
-s
Strip symbols from output
-U name
Undefine preprocessor macro

CAVEATS

The c99 command may not be available on all systems; it is required only on systems providing the POSIX C-Language Development option. On Linux, it typically invokes gcc or clang with appropriate flags for C99 compliance.

HISTORY

The c99 utility was introduced in IEEE Std 1003.1-2001 (POSIX.1-2001), based on the earlier c89 utility from ISO POSIX-2:1993. It reflects updates to support the ISO/IEC 9899:1999 C standard (C99).

SEE ALSO

gcc(1), clang(1), make(1), ld(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community