Determin compiler with preprocessor

This is a discussion on Determin compiler with preprocessor within the C++ Programming forums, part of the General Programming Boards category; How can I know which compiler is compiling my code?? For sure I'll need to use precompiler directives. NO, I ...

  1. #1
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722

    Determin compiler with preprocessor

    How can I know which compiler is compiling my code??
    For sure I'll need to use precompiler directives. NO, I DON'T WANT TO USE _WIN32, _WIN64, _MAC macros, or similars. Those represent the target platform.

    I want to know if the code is being compiled with Microsoft's cl, gcc, Borland, TurboC or any other you might remember.
    Last edited by xErath; 11-09-2004 at 01:39 PM.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Unfortunately, this too would be compiler specific. Have a look at some of the docs and tutorials that come with each compiler. I'm pretty sure TurboC defines __BORLAND__ or something similar.

    Or... were you aware of everything I just told you, and are just asking about what macro each compiler will define?

  3. #3
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    Macros...
    #ifdef __SOMETHING__
    //something compiler
    #elif
    ...
    #endif

    I only want the name of the macros...
    Last edited by xErath; 11-09-2004 at 01:41 PM.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    Uh! neat stuff! Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  4. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 05:42 AM
  5. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 10:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21