I've rebuild my answer... Damn, editing berserk :P:
You don't need to use partical one. And probably for MacOSX, Linux and other Unix-likes you don't need to use any at all.
Most popular one is (as far as Google tells the truth) is _WIN32
.
You never define it "by hand" in your source code. It is defined in one of these ways:
as a commandline preprocessor/compiler flag (like g++ -D _WIN32
)
or it is predefined by compiler itself (most of Windows compilers predefine _WIN32
, and sometimes other like WIN32
or _WIN32_
too. -- Then you don't need to worry about defining it at all, compiler does the whole work.
And my old answer:
You don't 'have to' anything. It's just for multi-platform compatibility. Often version of code for all Unix-likes (including Linux, MacOSX, BSD, Solaris...) and other POSIX platform will be completely the same and there must be some changes for Windows. So people write their code generally for Unix-likes and put some Windows-only (eg. DirectX instructions, Windows-like file paths...) parts between #ifdef _WIN32
and #endif
.
If you have some parts eg. X-Window-system only, or MacOS-only, you do similar with something like #ifdef X_WINDOW
or #ifdef MACOS
. Then, you need set a proper preprocessor definition while compiling (with gcc using -D flag, like eg. gcc -D _WIN32
).
If you don't write any platform-dependent code, then you don't need to care for such a #ifdef, #else, #endif
blocks. And most of Windows compilers/preprocessors AFAIK have predefined some symbols like _WIN32
(most popular, as far as google tells the truth), WIN32
, _WIN32_
, etc. So compiling it on Windows most probably you don't need to make anything else than just compiling.