Difference between GCC and G++

GCC stands for GNU Compiler Collection, as the name suggests it is a collection of compilers and it can be used in many operating systems starting from Windows to Linux. GCC is free software written by Free Software Foundation (FSF) and it compiles C & C++ languages.

G++ is a compiler command which compiles and links the source code of C++ files. We can easily compile using g++ by writing this command:

g++ code.cpp -o myoutput

Here code.cpp is the name of the original file which we are compiling and myoutput is the output file.

Difference between GCC and G++

GCC compiles c program files and they will be treated as C and C++ program files. All files will be treated as c++ files therefore it compiles only c++ program files.
GCC doesn’t link object files. G++ automatically links to the object files
GCC has fewer macros in it. G++ has more macros in it.

So these were the differences between gcc and g++. I hope it has cleared all doubts related to this topic, comment down below if you have any queries.

Leave a Comment

Your email address will not be published.