Caution: This version of this document is no longer maintained. For the latest documentation, see


Remove ifdef'ed C/C++ lines


unifdef [-l] [-t] [-c] [[-Dsym] [-Usym] [-iDsym] [-iUsym]]... [file]

Runs on:

QNX Neutrino


-Dsym -Usym
Specify which symbols to define or undefine respectively. The lines inside those ifdefs are copied to the output or removed as appropriate. The ifdef, ifndef, else, and endif lines associated with sym are also removed. If an ifdef X occurs nested inside another ifdef X, then the inside ifdef is treated as if it were an unrecognized symbol.
Cause the operation to be complemented, i.e. the lines that would have been removed or blanked are retained and vice versa.
Replace removed lines with blank lines instead of deleting them.
Disable parsing for C/C++ comments and quotes, which is useful for plain text.
-iDsym -iUsym
Ignore the specified ifdefs. Specifies which ifdef symbols to parse or not to parse for quotes and comments inside respectively. Parsing is done by default, and the -t option overrides these options.


The unifdef utility removes ifdef'ed lines from C or C++ code. You must specify at least one of -D, -U, -iD, and -iU. This utility copies output to stdout, and takes its input from stdin if you don't specify a file argument.

See also: