Get the Compile-time Environment Variables ?

Discussion in 'C Programming' started by Benoit Lefebvre, Nov 29, 2007.

  1. I need to know the Environment Variables for gcc at the compile time.

    eg: _AIX, __hpux, __GNUC__, etc..

    Is there a way to list that ?
    Benoit Lefebvre, Nov 29, 2007
    #1
    1. Advertising

  2. In article <>,
    Benoit Lefebvre <> wrote:
    >I need to know the Environment Variables for gcc at the compile time.
    >
    >eg: _AIX, __hpux, __GNUC__, etc..
    >
    >Is there a way to list that ?


    That's a question for a gnu newsgroup or mailing list.

    On one of my unix systems, the method was,

    $ gcc -E -dM - < /dev/null

    --
    We regret to announce that sub-millibarn resolution bio-hyperdimensional
    plasmatic space polyimaging has been delayed until the release
    of Windows Vista SP2.
    Walter Roberson, Nov 29, 2007
    #2
    1. Advertising

  3. On Nov 29, 3:08 pm, -cnrc.gc.ca (Walter Roberson)
    wrote:
    > In article <>,
    > Benoit Lefebvre <> wrote:
    >
    > >I need to know the Environment Variables for gcc at the compile time.

    >
    > >eg: _AIX, __hpux, __GNUC__, etc..

    >
    > >Is there a way to list that ?

    >
    > That's a question for a gnu newsgroup or mailing list.
    >
    > On one of my unix systems, the method was,
    >
    > $ gcc -E -dM - < /dev/null
    >
    > --
    > We regret to announce that sub-millibarn resolution bio-hyperdimensional
    > plasmatic space polyimaging has been delayed until the release
    > of Windows Vista SP2.


    Cool, thanks!

    --Ben
    Benoit Lefebvre, Nov 29, 2007
    #3
  4. Benoit Lefebvre

    Joe Guest

    On Nov 29, 2:47 pm, Benoit Lefebvre <> wrote:
    > I need to know the Environment Variables for gcc at the compile time.
    >
    > eg: _AIX, __hpux, __GNUC__, etc..
    >
    > Is there a way to list that ?


    I assume that you mean predefined macros? This is how I do it:

    $ touch tmp.c
    $ gcc -E -dM tmp.c

    The set of predefined macros varies with compiler flags, so this is a
    good way to find the exact set of macros produced for a given set of
    compiler flags. Some of the useful predefined macros are documented
    here: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/cpp/Common-Predefined-Macros.html
    Joe, Nov 29, 2007
    #4
  5. Benoit Lefebvre <> writes:
    > I need to know the Environment Variables for gcc at the compile time.
    >
    > eg: _AIX, __hpux, __GNUC__, etc..
    >
    > Is there a way to list that ?


    Those aren't environment variables; they're probably predefined
    macros. Environment variables are the things you access at run time
    using getenv().

    --
    Keith Thompson (The_Other_Keith) <>
    Looking for software development work in the San Diego area.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Nov 29, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YnNmbDQ0?=
    Replies:
    0
    Views:
    477
    =?Utf-8?B?YnNmbDQ0?=
    May 12, 2004
  2. RC
    Replies:
    4
    Views:
    7,993
    Tor Iver Wilhelmsen
    Jul 12, 2005
  3. flamesrock
    Replies:
    8
    Views:
    439
    Hendrik van Rooyen
    Nov 24, 2006
  4. Nagaraj
    Replies:
    1
    Views:
    841
    Lionel B
    Mar 1, 2007
  5. Carter
    Replies:
    2
    Views:
    490
    Carter
    Mar 4, 2009
Loading...

Share This Page