Tuesday, July 28, 2009

One compiler for Windows, Linux and Mac?

Is it possible for one compiler to compile C and C++ for Windows, Linux and Mac OS's and their corresponding different CPU's?

One compiler for Windows, Linux and Mac?
I'll answer with a different slant then the other answers. You can do what is called cross compiling. With gcc you can compile for one cpu architecture on another. Also you can cross compile for other operating system too. There is a compiler based on gcc that will compile console apps for Win32 on Linux or Linux apps on Windows called MinGW. To do GUI apps the software has to be engineered for portability from the beginning using cross platform API such as WxWindows, QT, or GTK.
Reply:You can use, say, GCC for Windows, *NIX and MAC OSX (that also can be said UNIX clone). But in any case you will need to recompile your code for different environments separately even if your code is fully portable: different, incompatible libraries...
Reply:Well, gcc can compile for all of these with different backends.





Although, this might be a trick question, since Windows, Linux and Mac OSX can all run on Intel CPUs!


No comments:

Post a Comment