2014-05-08 15 views
-6

我試圖檢測目標操作系統使用c宏_WIN32和_ CYGWIN_,但它顯示_ CYGWIN_未聲明的錯誤。 如何使用這些宏查找目標操作系統如何使用_WIN32和_CYGWIN_宏

+0

「#ifdef _WIN32」怎麼辦? –

回答

1

嘗試使用#ifdef。例如:

#ifdef __CYGWIN__ 
    // Cygwin specific code 
#else 
    // Other code 
#endif