compiler #defines that make compiler set unique

 

[ wxWidgets ] [ Borland C++ (now Embarcadero) ] [ Microsoft Visual C++ ] [ GNU gcc/gpp ] [ MinGW(gcc for windows) ] [ DJGPP (gcc for DOS) ] [ Linux gcc ]

#if !defined(_WIN64)||defined(_WIN32)
...//win9x code
#endif

wxWidgets (GUI library)

  • -DwxUSE_BASE=0
  • -D_UNICODE
  • -D__WXMSW__
  • -DHAVE_W32API_H
  • -DWXBUILDING
  • -mthreads
  • -I../../src/jpeg
  • -I../../src/tiff/libtiff
  • -I../../src/png
  • -I../../src/zlib
  • -I../../src/regex
  • -I../../src/tiff
  • -I../../src/expat/lib
  • -MD
  • -MP

Borland C++

  • __BORLANDC__
  • __cplusplus (only if compiling a C++ file or forcing C++ compilation [-P])
  • __STDC__

Microsoft Visual C++

  • _MSC_VER
  • _MSC_EXTENSIONS (don't know what this is for)
  • __cplusplus (only if compiling a C++ file or forcing C++ compilation [/Tp or /TP])
  • _WIN64 (only if target is 64-bit)
  • __STDC__

MSVC definitions (without documentation)

GNU gcc/gpp (includes djgpp, MinGW)

  • __GNUC__
  • __cplusplus (only if compiling with g++/gpp or compiling with gcc -x c++)
  • _WIN64 (only if target is 64-bit)
  • __STDC__

MinGW (gcc for windows)

  • __GNUC__
  • __MINGW32__ (this is regardless of 32 or 64-bit)
  • __cplusplus (only if compiling with g++ or compiling with gcc -x c++)
  • _WIN64 (only if target is 64-bit)
  • __STDC__
  • __MINGW64_VERSION_MAJOR
  • __MINGW64_VERSION_MINOR

MinGW is a 32-bit compiler and mingw-w64 is a 32/64-bit gnu compiler set for windows which includes gnat, ada, g77(fortran77), java, and I am sure I am missing the others if there are any. MSYS is a companion set of UNIX build tools for windows and a BASH shell. The version of gcc is now at version 3.4.5 gor mingw and 4.4.5 for mingw-w64 as of 10/17/2010.

packing pragmas (how to make sure there are no holes/gaps in your structures during execution).

gcc and __STDC__

DJGPP (gcc for DOS)

  • __GNUC__
  • __DJGPP__
  • __MSDOS__
  • __GO32__
  • __cplusplus (only if compiling with gpp or compiling with gcc -x c++)
  • __STDC__

DJGPP is a 32-bit gnu compiler set for MSDOS/FreeDOS which includes gnat, ada, g77(fortran77), java, and I am sure I am missing the others if there are any. It includes a companion set of UNIX build tools for DOS and a bourne shell and emacs and a programmer's IDE. The version of gcc is now at version 4.3.2.

gcc and __STDC__

Linux gcc

check this article before using the LINUX #define! I do not know any more than this about building for linux. I know each distribution is different and potentially has different #defines for it.

  • LINUX (only if defined in makefile.am)
  • __GNUC__
  • __cplusplus (only if compiling with g++/gpp or compiling with gcc -x c++)
  • __STDC__
  • __LP64__

32/64-bit gnu compiler set for linux (just download and compile the source tarball from ftp.gnu.org) which includes gnat, ada, g77(fortran77), java, and I am sure I am missing the others if there are any. You get the latest of everything you want with linux gnu compiler set, and most of the time it compiles too. but you have to do it in a certain order. you'll find out as you go along which needs to come first (dependencies, dependencies, headache, headache, download, download, recompile, recompile). corrections/additions for this entry? contact me.

gcc and __STDC__

OSX gcc

check this article for the rest of the #defines.

  • LINUX (only if defined in makefile.am)
  • __GNUC__
  • __cplusplus (only if compiling with g++/gpp or compiling with gcc -x c++)
  • __STDC__

32/64-bit gnu compiler set for linux (just download and compile the source tarball from ftp.gnu.org) which includes gnat, ada, g77(fortran77), java, and I am sure I am missing the others if there are any. You get the latest of everything you want with linux gnu compiler set, and most of the time it compiles too. but you have to do it in a certain order. you'll find out as you go along which needs to come first (dependencies, dependencies, headache, headache, download, download, recompile, recompile). corrections/additions for this entry? contact me.

gcc and __STDC__

OpenWatcom

  • __WATCOMC__
  • __386__
  • BUILD_DLL /* Codeblocks */
  • __STDC__ (I think)

see article post

additional platforms welcome

contact me with new #defines

predefined macros
OpenWatcom predefined macros (this is the compiler manual)
see about p.160 (172 in tne entry box)
gcc -E -dM (sorry, no docs yet)