Advertisement
Combreal

crossPlatform01.cpp

Apr 10th, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #ifdef _WIN32
  2.     //Windows
  3.     #include "stdio.h"
  4.     #include <iostream>
  5.     #include "windows.h"
  6.     #include "math.h"
  7. #elif __APPLE__
  8.     #include "TargetConditionals.h"
  9.     #include "stdio.h"
  10.     #include <iostream>
  11. #elif __linux__ //__GNUC__
  12.     // linux
  13.     #include "stdio.h"
  14.     #include <iostream>
  15. #elif __unix__
  16.     // Unix
  17.     #include "stdio.h"
  18.     #include <iostream>
  19. #elif defined(_POSIX_VERSION)
  20.     // POSIX
  21.     #include "stdio.h"
  22.     #include <iostream>
  23. #else
  24. #   error "Unknown compiler"
  25. #endif
  26.  
  27. using namespace std;
  28.  
  29. int main(void)
  30. {
  31.     #ifdef _WIN32
  32.     {
  33.         cout<<"Windows world"<<endl;
  34.         system("pause");
  35.     }
  36.     #endif
  37.     #ifdef __APPLE__
  38.     {
  39.         cout<<"Mac world"<<endl;
  40.     }
  41.     #endif
  42.     #ifdef __linux__
  43.     {
  44.         cout<<"Linux world"<<endl;
  45.     }
  46.     #endif
  47.     #ifdef __unix__
  48.     {
  49.         cout<<"Unix world"<<endl;
  50.     }
  51.     #endif
  52.     #ifdef _POSIX_VERSION
  53.     {
  54.         cout<<"Posix world"<<endl;
  55.     }
  56.     #endif
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement