Scroll to navigation



gdc - A GCC-based compiler for the D language


gdc [-c]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...

For any given input file, the file name suffix determines what kind of compilation is done:

D source files.
D interface files.
Object files to link in.
Library files to link in


The gdc command is a frontend to gcc and supports many of the same options. This manual only documents the options specific to gdc. Most of these have both positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default.

The gdc command may be used to compile D source code into an object file, link a collection of object files together, or do both in sequence.

Only the most useful options are listed here; see below for the remainder.


Compile release version.
Compile in unittest code.
Turn off code generation for runtime assert()'s.
Turn off code generation for runtime invariant()'s.
Turn off code generation for runtime in() contracts.
Turn off code generation for runtime out() contracts.
Turns off array bounds checking for all functions.
Don't recognize built-in functions that do not begin with __builtin_ as prefix.
Turns off generation of module information and related functions.
Print information about D language processing to stdout.
For D2, enforce @property syntax.
List all variables going into thread local storage.
Ignore unsupported pragmas.
Split dynamic arrays into length and pointer when passing to functions.
Control template emission behaviour.

Turning on this option will emit all templates, but make them private to the translation unit. The executable will have multiple copies of code and data.

Turning off this option will tell the compiler to not emit templates at all.

The default behaviour is to emit templates, but only if the compiler determines that it needs to.

Compile in debug code into the program.

These are supported options:

Compile in debug code <= level.
Compile in debug code identified by ident.
Write module dependencies to filename.
Write makefile dependency output to the given file.
Like -fmake-deps=filename but ignore system header files.
Process all modules specified on the command line, but only generate code for the module specified by the argument.
Compile in version code into the program.

These are the supported options:

Compile in version code >= level.
Compile in debug code identified by ident.
Generate D interface files.
Write D interface files to directory.
Write D interface file to filename.
Generate documentation.
Write documentation file in directory.
Write documentation file to filename.
Include a Ddoc macro file.
Write JSON file to filename.
Dump decoded UTF-8 text from source.
Warn about casts that will produce a null or nil result.
Make all warnings into errors.
Do not warn about usage of deprecated features.
Warn when a pragma is encountered that is not understood by GDC.


gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entries for gdc and gcc.


Copyright (c) 2011, 2012, 2013 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the man page gfdl(7).

2018-10-26 gcc-6