Does GCC have any built-in DEBUG preprocessor flags?

Rupert Wood
Fri Dec 6 10:09:00 GMT 2002

Joseph D. Wagner wrote:

> I'm wondering if GCC automatically defines any preprocessor DEBUG
> flags when executed with the -g option.

At first glance through specs and source, no.

> For example, when a program compiles on Microsoft Visual C++ in
> Debug mode, the compiler automatically defines _DEBUG as a
> preprocessor flag,

_DEBUG is auto-defined for /MDd, /MTd or /MLd - i.e. it's more "compiled
for debug runtime". /Zi and /ZI (more analagous to -g) don't trigger it.

In any case, MSVC-generated projects explicitly include -D_DEBUG on
debug compile lines.


More information about the Gcc-help mailing list