Last active
June 6, 2016 17:43
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Código em linguagem C para criar código específico para a plataforma Linux ou Windows dependendo do ambiente onde se estiver compilando.