c-compiling-on-windows-and-linux-ifdef-switch
#include <stdio.h>
#include <stdlib.h>
#ifdef __linux__
//linux code goes here
#define SYS_INFO "linux"
#elif _WIN32
// windows code goes here
#define SYS_INFO "windows"
#else
#define SYS_INFO "unknown"
#endif
int main()
{
printf("Hello world!\n");
printf("System info: %s.\n", SYS_INFO);
return 0;
}
// ref: http://stackoverflow.com/questions/6649936/c-compiling-on-windows-and-linux-ifdef-switch