Checking a platform

#ifdef _WIN32 // note the underscore: without it, it's not msdn official!

    // Windows (x64 and x86)

#elif __unix__ // all unices

    // Unix

#elif __posix__

    // POSIX

#elif linux

    // linux

#elif __APPLE__

    // Mac OS, not sure if this is covered by __posix__ and/or __unix__ though...

#endif

//__MINGW32__
//__GNUC__ 
// _AIX32, _AIX41, _AIX43, __HOS_AIX__ (_AIX32 (the OS version >= 3.2) maybe useful)
//  

ex)
when a binary is complied by GCC 4.4.5 on Ubuntu 10.10
__unix__, linux, __GNUC__ are defined. 



Macros for Visual C
 (+ANSI macros)
Macros for gcc

http://docs.wxwidgets.org/stable/wx_cppconst.html

UI system
__WINDOWS__ any Windows, yom may also use __WXMSW__
__WIN16__ Win16 API (not supported since wxWidgets 2.6)
__WIN32__ Win32 API
__WXBASE__ Only wxBase, no GUI features (same as wxUSE_GUI == 0)
__WXCOCOA__ OS X using Cocoa API
__WXWINCE__ Windows CE
__WXGTK__ GTK+
__WXGTK12__ GTK+ 1.2 or higher
__WXGTK20__ GTK+ 2.0 or higher
__WXMOTIF__ Motif
__WXMOTIF20__ Motif 2.0 or higher
__WXMAC__ Mac OS all targets
__WXMAC_CLASSIC__ MacOS for Classic
__WXMAC_CARBON__ MacOS for Carbon CFM (running under Classic or OSX) or true OS X Mach-O Builds
__WXMAC_OSX__ MacOS X Carbon Mach-O Builds
__WXMGL__ SciTech Soft MGL (__WXUNIVERSAL__ will be also defined)
__WXMSW__ Any Windows
__WXOSX__ Any Mac OS X port (either Carbon or Cocoa)
__WXPALMOS__ PalmOS
__WXPM__ OS/2 native Presentation Manager
__WXSTUBS__ Stubbed version ('template' wxWin implementation)
__WXXT__ Xt; mutually exclusive with WX_MOTIF, not implemented in wxWidgets 2.x
__WXX11__ wxX11 (__WXUNIVERSAL__ will be also defined)
__WXWINE__ WINE (i.e. WIN32 on Unix)
__WXUNIVERSAL__ wxUniversal port, always defined in addition to one of the symbols above so this should be tested first.
__X__ any X11-based GUI toolkit except GTK+ 

Operating systems
__APPLE__ any Mac OS version
__AIX__ AIX
__BSD__ Any *BSD system
__CYGWIN__ Cygwin: Unix on Win32
__DARWIN__ Mac OS X using the BSD Unix C library (as opposed to using the Metrowerks MSL C/C++ library)
__DATA_GENERAL__ DG-UX
__DOS_GENERAL__ DOS (used with wxMGL only)
__FREEBSD__ FreeBSD
__HPUX__ HP-UX (Unix)
__GNU__ GNU Hurd
__LINUX__ Linux
__MACH__ Mach-O Architecture (Mac OS X only builds)
__OSF__ OSF/1
__PALMOS__ PalmOS
__SGI__ IRIX
__SOLARIS__ Solaris
__SUN__ Any Sun
__SUNOS__ Sun OS
__SVR4__ SystemV R4
__SYSV__ SystemV generic
__ULTRIX__ Ultrix
__UNIX__ any Unix
__UNIX_LIKE__ Unix, BeOS or VMS
__VMS__ VMS
__WINDOWS__ any Windows
__WINE__ Wine

Compilers
__BORLANDC__ Borland C++. The value of the macro corresponds to the compiler version: 500 is 5.0.
__DJGPP__ DJGPP
__DIGITALMARS__ Digital Mars
__GNUG__ Gnu C++ on any platform, see also wxCHECK_GCC_VERSION
__GNUWIN32__ Gnu-Win32 compiler, see also wxCHECK_W32API_VERSION
__MINGW32__ MinGW
__MWERKS__ CodeWarrior MetroWerks compiler
__SUNCC__ Sun CC
__SYMANTECC__ Symantec C++
__VISAGECPP__ IBM Visual Age (OS/2)
__VISUALC__ Microsoft Visual C++. The value of this macro corresponds to the compiler version: 1020 for 4.2 (the first supported version), 1100 for 5.0, 1200 for 6.0 and so on
__XLC__ AIX compiler
__WATCOMC__ Watcom C++. The value of this macro corresponds to the compiler version, 1100 is 11.0 and 1200 is OpenWatcom.
_WIN32_WCE Windows CE version
 
Posted by 배트
,