Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if you're compiling on Windows?

Tags:

c++

windows

Something like:

#ifdef WINDOWS
// do stuff
#endif
like image 212
y2k Avatar asked Jan 31 '10 22:01

y2k


Video Answer


2 Answers

The _WIN32 is always defined on Windows platform, checkout the predefined macros.

like image 197
Zoran Regvart Avatar answered Sep 23 '22 13:09

Zoran Regvart


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

like image 31
Chris H Avatar answered Sep 20 '22 13:09

Chris H