What C preprocessor conditional should I use for OS X specific code?

前端 未结 6 1683
别跟我提以往
别跟我提以往 2021-02-02 10:31

What C preprocessor conditional should I use for OS X specific code? I need to include a specific library if I am compiling for OS X or a different header if I am compiling for

6条回答
  •  囚心锁ツ
    2021-02-02 11:21

    This code example may help you -

    if defined(__APPLE__)
    #include "TargetConditionals.h"
      if (!defined(TARGET_OS_IPHONE) && !defined(TARGET_IPHONE_SIMULATOR))
     {
       //write your OSX specific code here
     } 
    

提交回复
热议问题