05
2016-Mar
[C/C++] OS 구분 전처리기 매크로
작성자: Blonix
IP ADRESS: *.148.87.98 조회 수: 1560
* 리눅스
#if defined(__linux__)
/* Linux. --------------------------------------------------- */
#endif
* OSX, iOS
#if defined(__APPLE__) && defined(__MACH__)
/* Apple OSX and iOS (Darwin). ------------------------------ */
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR == 1
/* iOS in Xcode simulator */
#elif TARGET_OS_IPHONE == 1
/* iOS on iPhone, iPad, etc. */
#elif TARGET_OS_MAC == 1
/* OSX */
#endif
#endif
* 윈도우즈
#if defined(_WIN64)
/* Microsoft Windows (64-bit). ------------------------------ */
#elif defined(_WIN32)
/* Microsoft Windows (32-bit). ------------------------------ */
#endif
http://beefchunk.com/documentation/lang/c/pre-defined-c/preos.html