Solved

Cross platform utils

Posted on 1997-02-20
1
297 Views
Last Modified: 2010-04-15
I want to write a cross-platform utility in C, which will display the compiler that is being used and so on.
How do i come to know the compiler being used, like turboc, Microsoft or lattice?
0
Comment
Question by:Rocky020697
1 Comment
 

Accepted Solution

by:
glewis earned 20 total points
ID: 1249652
The best way to do this, and the method I have used for many years is to simply find out what symbols each compiler's preprocessor defines by default, and then do something like this:

#ifdef AZTEC_C
   ...code
#else
#ifdef MANX_C
   ...code
#else
#ifdef TURBO_C
   ...code
#else
#ifdef WATCOM
   ...code
#else
   Woah, Glenn!  Which compiler is this?
   /* Obviously, the above line causes a compilation error */
#endif
#endif
#endif
#endif


0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now