473,583 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compiler identification macro?

Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

Thanks!
Jul 22 '05 #1
5 4533
Carl Ribbegaardh wrote:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?


It's possible, but exactly what macros you look for differs from system
to system. See, for example:

GCC: Common Predefined Macros (macros defined in every port of GCC)
http://gcc.gnu.org/onlinedocs/gcc-3....fined%20Macros

GCC: System-specific Predefined Macros (how to find system-specific GCC
macros)
http://gcc.gnu.org/onlinedocs/gcc-3....fined%20Macros

Microsoft: Predefined Macros
http://msdn.microsoft.com/library/de...ned_macros.asp

I usually look for _MSC_VER to identify Microsoft compilers.

Since the answer to your question differs from system to system, you'll
have better luck seeking answers on newsgroups devoted to your
platform/compiler (assuming you can't find the answers in the
documentation).

Regards,

Russell Hanneken
rg********@pobo x.com
Remove the 'g' from my address to send me mail.
Jul 22 '05 #2

"Carl Ribbegaardh" <ca************ *********@hotma il.com> wrote in message
news:c6******** ****@ID-111741.news.uni-berlin.de...
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows too.
Is it called compiler identification macros or is there another term I
should search for?


These should be in the specific documentation for each compiler you are
using. For Digital Mars C++, the correct way to identify it is:

#ifdef __DMC__
// You're running the Digital Mars C++ compiler
#endif

Do not use WIN32, as that specifies the target operating system, and many
diverse compilers target WIN32.

-Walter
www.digitalmars.com free C/C++/D compilers
Jul 22 '05 #3
Użytkownik Carl Ribbegaardh napisał, On 2004-04-30 02:45:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

http://predef.sourceforge.net/precomp.html
Best
Darek
--
Life sucks, but it's better than the alternative.
Jul 22 '05 #4
Thanks a lot for your help guys!! :-D
Jul 22 '05 #5
On Fri, 30 Apr 2004 10:18:33 +0200, void <chq@nie_spamuj .wp.pl> wrote:
Użytkownik Carl Ribbegaardh napisał, On 2004-04-30 02:45:
Is there any known list of compiler identification macros?
I'm using VS 2003, g++ on windows, sun's cc and g++ on solaris. Is it
possible to identify the compiler using macros?
I'm aware of WIN32 being defined, but that's defined on mingw g++ in windows
too.
Is it called compiler identification macros or is there another term I
should search for?

http://predef.sourceforge.net/precomp.html


Man, I sure wish I'd have known about that page when I was struggling with
this very issue when working on InitUtil. But that was before I'd begun
dabbling in newsgroups, and it never occurred to me I could just ask the
question! So great answer, and equally great question ;-)
-leor
Best
Darek


--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2221
by: Paul Sheer | last post by:
I have managed to build Python 2.3.3 with the aCC HP-UX C++ compiler by making a number of one-line changes. (For reasons beyond my control, I am forced to use this compiler and it has no C mode at all.) Typically to get the Python source code to compile under aCC one has to make a number of trivial changes of the form, struct whatzit...
7
2068
by: winlinchu | last post by:
Hi! I use Python, and writing some extension modules I think which could be written an C compiler, useful only to compile extension modules (I not think an GCC!!!!), so that the user not have to use GCC, Microsoft Visual C++, or other. It must have an common API to all platforms, even if obviously the implementation is various. Could be...
3
5907
by: Sisyphus | last post by:
Hi, Is there anything in the ANSI C standard covering the means by which I can determine the operating system and compiler being used (at the preprocess stage) ? If so, then how might I determine (at the preprocess stage) whether the operating system upon which the app is being built is Win32 or not, and whether the compiler being used...
2
1647
by: suresh | last post by:
Hello to you all In my .Net application, I want to import document images (Tiff images), having same format, in a batch, For e.g. I have a document folder containing mixed images like 'Participant Registration forms', 'Team Registration Forms', 'Event Details', etc. I want to process each type of documents in separate batches
55
12784
by: Steve | last post by:
I have to develop several large and complex C++ hardware test programs that should work under DOS, most likely with 32-bit DOS extender. Development workstation OS would be Microsoft XP. Quite some time ago I worked in DOS, with Borland BC++ 4.1. I do not have it any more. Which compiler would you recommend me now? Which ones support serious...
6
2413
by: Michael B Allen | last post by:
Hi, I have a macro that looks like the following: #define MMSG msgno_loc0(LOC0, LOC1) && msgno_mmsg0 which if used in some code like: MMSG("foo=%s", foo);
2
2199
by: talkaboutquality | last post by:
Need to define a macro as, say, #ifdef NEED_FUNCTION foo(x) #else #endif
11
4204
by: David Mathog | last post by:
There was an editing error in one of my programs giving this line (two left parentheses, one right): FD_SET((ncmd->cmd_in_fd,&read_set); When compiled with gcc -Wall -pedantic -stc=c99 it issued this warning for that line number:
27
3053
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in the source (gcc-4.3.1/gcc/c-common.c) of gcc 4.3.1, is a syntax error. I'm inclined to agree, as it is like no C I have ever met. what is ...
0
7894
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8321
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7931
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5370
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3816
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1154
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.