Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

How to differentiate between ubuntu and redhat using c preprocessor ?

Discussion in 'Ubuntu' started by Zeno, Jul 26, 2012.

  1. Zeno

    Zeno Guest

    Hi,



    I am a newbie to C programming, I am writing a cross platform C code. Is there any C preprocessor to differentiate between Ubuntu and RedHat Linux Distros?

    Is there any other way I can do this?

    Thanks in Advance.
     
  2. Akendo

    Akendo Guest

    Hi Zeno,

    Welcome to the LinuxForum.

    In every Linux your using the GNU Compiler Collection (Wikipedia:gcc). The only different is sometime where there are locates as file itself. Redhat sometime (or Ubuntu/Debian). But this should not matter.

    But Redhat uses always the older and stable releases of the gcc. So when your develop with something new you can't expect working in Redhat by default.


    Hopefully this was helpful.

    so far
    Akendo
     
    1 person likes this.
  3. Theophrastus

    Theophrastus Guest

    some combination of this sort of maneuver may accomplish that:
    gcc "-DCOMPILED_ON=\"`uname -a`\"" -c file.c -o file.o

    see:
    for some odd reason i'm not seeing how i can be permitted to include a useful link to this approach perhaps if i mangle the link i can get it through: "http:" + // +
    stackoverflow.com/questions/5319289/can-the-gcc-c-preprocessor-use-the-output-of-a-shell-command
     
  4. Zeno

    Zeno Guest

    Could you please suggest me how this can be done.
     

Share This Page