I would like to do a program but there is a code that works only on Windows and another on GNU / Linux, I would like to know how I can use the preprocessor macros to do this, read something about it, that proposed this example :
int main()
{
#ifdef WINDOWS
//Codigo de Windows
#endif
#ifdef LINUX
//Codigo de Linux
#endif
}
What are the Windows directives?
That is, when doing #ifdef WINDOWS
is checking if the macro WINDOWS
is defined, and how should that definition be above the function main()
?
Extra: Example code using ifdef
#define PI 3,14
int main()
{
#ifdef PI
puts("Casa");
#enifdef
}