How do you know if you are compiling on Windows?

Sort of:

#ifdef WINDOWS
// do stuff
#endif
+6
source share
4 answers

_WIN32 is always defined on the Windows platform; check the predefined macros .

+16
source

This is the most complete table I know. https://sourceforge.net/p/predef/wiki/Compilers/

+7
source

, .

, SDK .

, CRT Win32, .

0

I'm not quite sure I understand the question, but yes, you can do it. Obviously, you need to tell the compiler that you are compiling on Windows (or the x operating system) at compile time. I saw a similar approach used for the bit size of things like integers.

0
source

Source: https://habr.com/ru/post/1730793/


All Articles