Specify the platform using #ifdefs

c, c++

Solution

It's similar:

#ifdef __linux__
    // Linux code
#endif

Since you are going to have either one of these three defined at a time, this should be ok for all three.

List of defines.

Problem

To handle platform specific code between Mac and Windows, WIN32 and APPLE are the terms to use, right? So, thw code would look like this: ``` #ifdef _WIN32 // Windows code #endif #ifdef __APPLE__ // Mac code #endif ``` What about Linux ? How can i do that for all three? right

Original source

Related problems