Skip to content

Instantly share code, notes, and snippets.

@lucivaldo
Last active June 6, 2016 17:43
Show Gist options
  • Save lucivaldo/303e29b0bdb45712eab09eee40001437 to your computer and use it in GitHub Desktop.
Save lucivaldo/303e29b0bdb45712eab09eee40001437 to your computer and use it in GitHub Desktop.
Código em linguagem C para criar código específico para a plataforma Linux ou Windows dependendo do ambiente onde se estiver compilando.
#include <stdio.h>
#if defined(__linux__) || defined(__linux)
#define LINUX
#endif
#if defined(__WIN32__) || defined(__NT__)
#define WINDOWS
#endif
int main(int argc, char const *argv[])
{
#ifdef LINUX
puts("Código para Linux!");
#endif
#ifdef WINDOWS
puts("Código para Windows!");
#endif
return 0;
}
@lucivaldo
Copy link
Author

Código em linguagem C para criar código específico para a plataforma Linux ou Windows dependendo do ambiente onde se estiver compilando.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment