Re: g++ -D compiler options



Mark Hobley wrote:

What are the effects of the -D options?

-Ddebian
-D_GNU_SOURCE
-DUSE_TERMIO
-DKLUDGELINEMODE


These effectivly insert #defines in the preprocessor stage. Hence if you
compile with -Ddebian, and in your code you have

#ifdef debian
some code
#else
some other code
#endif

The -Ddebian is equivalent to inserting a line which says

#define debian

at the top of the C file you're currently compiling.

Instead of debian you could substute BobTheBuilder and it would still do the
same. It's just a symbol. The _GNU_SOURCE has a particular meaning in the
GNU C library (and a few other places) - it makes the header recognise
certain GNU extensions which are not quite POSIX-compliant (e.g. if you want
to have the strsignal() function available in string.h you have to define
_GNU_SOURCE before including it - you can do that using this flag).

Cheers,

- Daniel
--
*************************************************************************
* Daniel Franklin - Lecturer in Computer Engineering
* University of Wollongong, NSW, Australia * d.franklin at ieee.org
*************************************************************************
.



Relevant Pages

  • Re: pros/cons of installing from source
    ... However debian is not the only distro with such commitment. ... I think that the packaging policy is what really sets debian ... developers, the admin of the system is the developer at the same time, ... and he/she is the one deciding what to compile against (libraries, ...
    (Debian-User)
  • ASUS A7N8X Deluxe Questions
    ... I was trying to get Debian working properly on my ... This was traced to an apparent need to compile a 2.4.22 kernel (I was ... with a Knoppix CD so I could write down my partition info. ...
    (Debian-User)
  • computer freezes, no obvious reason
    ... I recently installed debian stable. ... and compiled myself the latest kernel version: ... When I try to compile something with g++ every now and then I get the ... 00:0f.1 Audio device: nVidia Corporation MCP55 High Definition Audio (rev ...
    (Debian-User)
  • Re: VMWare player: why no package?
    ... a similar program 'Virtual Box' is packaged for Debian. ... I had to rebuild the kernel because VMWare Player requires certain ... installer will then try to compile them, but they GCC build has to match the ...
    (Debian-User)
  • Re: Suggestions Invited
    ... I was once a Gentoo fan for its emerge and quick releases, ... Debian is all about being easy to get up and keep up. ... > having to compile every little obscure library for a point update. ... > about dependencies making an upgrade of gnome or kde nearly impossible. ...
    (Debian-User)