How do I determine which C/C++ compiler to use?

pylonicon picture pylonicon · May 10, 2010 · Viewed 22k times · Source

I am trying to figure out which C/C++ compiler to use. I found this list of C/C++ compilers at Wikipedia:

http://en.wikipedia.org/wiki/List_of_compilers#C.2FC.2B.2B_compilers

I am fairly certain that I want to go with an open source compiler. I feel that if it is open source then it will be a more complete compiler since many programmer perspectives are used to make it better. Please tell me if you disagree.

I should mention that I plan on learning C/C++ mainly to program 2D/3D game applications that will be compatible with Windows, Linux, MAC and iPhone operating systems. I am currently using Windows Vista x64 OS.

Answer

Uri picture Uri · May 10, 2010

First of all, IMHO as a beginner your development environment (IDE) matters a lot more than the compiler.

I think that people place too much emphasis on compiler choice early on. While it is not Java, C++ is meant to be portable.

If the program you're writing only works with specific compilers, you're probably doing the wrong thing or can work a little on making it more portable.

If you get to a point where compiler choice makes a significant performance impact for you, then you've already perfected everything else in your program and you're in a good state and you are also quite advanced in your abilities. We used to teach the differences between compilers at fairly advanced stages in the CS curriculum.

If you use a UNIX based machine (Linux, Mac, actual Linux), then pretty much GNU (g++) is the way to go and is fairly much standard. If it's good enough to compile your OS, it's probably good enough for you. On a mac you can use XCode as your IDE, and it interfaces well with g++. On Linux some people prefer command line tools, though you might like the Eclipse C++ support, it is much better today than it was 3-4 years ago.

Things on Windows are trickier. If you can afford it, have access to, or are eligible for one of the free editions (e.g., via a school), I think the Microsoft Visual C++ Environments (or whatever they are called now) are pretty good for learning and they are used in production. I think there's actually a lightweight visual studio now with an emphasis on C++ that could be a good start. If you don't, you can probably find a distribution of Eclipse that is specific for C++ and includes an implementation of the GNU compilers.