Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    How to differentiate between ubuntu and redhat using c preprocessor ?

    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. #2
    Join Date
    Feb 2012
    Location
    Europe
    Posts
    138
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Rep Power
    2
    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
    Feel free to follow my blog.

  3. The Following User Says Thank You to Akendo For This Useful Post:

    Zeno (07-26-2012)

  4. #3
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by Zeno View Post
    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.
    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

  5. #4
    Join Date
    Jul 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Could you please suggest me how this can be done.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
           








Check out Linux Central for Linux software and other goodies!





» Stats

Members: 3,573
Threads: 3,920
Posts: 9,442
Top Poster: Fred (1,486)
Welcome to our newest member, Ronald de Souza

» Links



Powered by vBadvanced CMPS