C++ compiling on Windows and Linux: ifdef switch [duplicate] October 15, 2022 by Tarik use: #ifdef __linux__ //linux code goes here #elif _WIN32 // windows code goes here #else #endif