How do I check if one of multiple macros is defined in a single #ifdef?

前端 未结 2 1433
猫巷女王i
猫巷女王i 2020-12-16 14:27

I have some C++ code, and want to perform an action if the __APPLE__ or __linux macros are defined.

If I did it as a normal if

2条回答
  •  执念已碎
    2020-12-16 15:06

    You can't in a single #ifdef would a single #if do instead?

    #if defined(__APPLE__) || defined(__linux)
    

    this also works if you prefer

    #if defined __APPLE__ || defined __linux
    

提交回复
热议问题