I just need to make clear one thing. In University we are learning the C++ programming language and they suggest us to use the GNU C++ Compiler which is part of the GCC. So on my Mac OS X Mavericks I download the command line tools from the developers.apple.com. I wrote a simple C++ program and I compile this program using the g++ command like this:
g++ program.cpp
./a.out
And the program runs perfect. But as I know, using a different compiler, means that you have to use the correct syntax/commands/libraries for this spesific compiler, so while in the University we use the "GNU C++ compiler", I just want to make clear that with the g++ command is meant that I use the "GNU C++ Compiler".
Cheers.
Traditionally, gcc
and g++
are both components of the GNU C compiler suite. gcc
is the C compiler, and g++
is the C++ compiler.
On current versions of Mac OS X, the commands gcc
and g++
are both treated as alternate names for clang
and clang++
, which are components of the Clang C compiler. However, this compiler is almost entirely compatible with GCC — the few differences that do exist will almost certainly not come up in the coursework you're doing.
(The most significant difference is that Clang's diagnostics are much better: it will point out exactly where a syntax error occurs in a line, rather than just what line it's on, and it can often identify potential typos or subtle mistakes in situations where GCC would just give you a cryptic error message. If you're just learning C, you will appreciate this a lot.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With