Published May 10, 2020 - Author: zgxsin
GNU compiler collection (GCC) is a collection of compilers for programming such as C++, C, Objective-C, Java, and Fortran. GCC release is through a free software foundation operated through the command line. The GCC development is by Richard Stallman as part of GNU project.
The GNU provide the optimizing compiler for C++ which is known as g++. g++ is mainly designed for compiling C++ programming language.
GCC is a compiler used for C language compilation whereas g++ is a compiler used for C++ programming language. There are some differences between these two compilers.
The main difference between GCC and g++ is filename extension. The gcc treats the .c as a C file where as g++ treats both .c and cpp as C++ files.
During the compiling phase g++ call the GCC so g++ is the complete compiler and it is not the pre-processor of any other compiler.
g++ compiler builds the object code from source code, and it does not generate any intermediate C version of the program.
While compiling C++ program, the GCC does not link by default and suppose you require then there are –Istdc++ command for linking. The g++ will link to the C++ libraries automatically by default.
For a compilation of C program, GCC uses the following command
gcc program.c -o binary
Here program.c is the C source file name where the binary is the executed object file .
For compilation of C++ program, g++ uses the following command
g++ program.cpp –o binary
Here program.cpp is the C++ source file name and binary is the executed object file.