View Single Post
Join Date: Aug 2005
Posts: 15,171
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1439
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: how to identify which OS I am using

 
0
  #17
Oct 2nd, 2008
Originally Posted by onemanclapping View Post
what do you mean by "create the makefiles for each os"? sorry, I'm a bit of a noob :/

I did:
  1. #include <iostream>
  2. using std::cout;
  3. using std::cin;
  4. using std::endl;
  5.  
  6. void clearScreen()
  7. {
  8. #ifdef _WIN32
  9. system("cls");
  10. #elif defined(_UNIX)
  11. system("clear");
  12. #endif
  13. }
  14.  
  15. int main()
  16. {
  17. cout << "coco" << endl;
  18. cin.get();
  19. clearScreen();
  20. cout << "coco2" << endl;
  21. }

and the result:
  1. omc@linus-marx:~$ /home/omc/workspace/LigaSagres/Debug/LigaSagres
  2. coco
  3.  
  4. coco2
  5. omc@linus-marx:~$

so it didn't work. I guess maybe because I have not created "the makefiles for each os"
What do you mean by "it didn't work" ? I don't know what that stuff is that you posted.

"makefile for each os" means that you have to compile your program in each os -- once under *nix and again under MS-Windows. You can't compile once and run on both operating systems -- that won't work.

If you use g++ compiler then you can probably have one source file and use the same compiler on both os. You will need a version of g++ for unix and another version of g++ for MS-Windows.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote