开发者

How to tell if you're compiling on Windows?

开发者 https://www.devze.com 2022-12-19 05:25 出处:网络
Someth开发者_JAVA百科ing like: #ifdef WINDOWS // do stuff #endif The _WIN32 is always defined on Windows platform, checkout the predefined macros.This is the most complete table I know of.

Someth开发者_JAVA百科ing like:

#ifdef WINDOWS
// do stuff
#endif


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


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


It depends on what files are you using.

The compiler itself doesn't have such a flag, but it is common to have such a define in the operating system's SDK.

For example, the CRT has a Win32 define, which affects how it is compiled.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消