C Preprocessor testing definedness of multiple macros

[亡魂溺海] 提交于 2019-11-28 07:58:29

Try:

#if defined(_WIN32) || defined(_WIN64)
// do stuff
#endif

The defined macro tests whether or not a name is defined and lets you apply logical operators to the result.

You must use #if and special operator defined

I think it should be possible this way:

#if defined block1 || defined block2 /*or any other boolean operator*/
   /*Code*/
#endif

More information here

Use defined:

#if defined(A) || defined(B)
    #include <whatever.h>
#endif
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!