GCC:
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.
For each programming language, GCC contains the separate program. In GCC all languages have a common internal structure that consists of a language-specific front end which parses the programs and generates an abstract syntax tree and back end.
The GCC also contains the full-featured ANSI C compiler. This compiler allows the multiple levels of source code error checking that are usually provided by other tools. It also performs many types of optimization on the resulting object code and debugging information.
The GCC is the main compiler for various operating systems such as Linux, BSD, and MAC OS X. As GCC is freely available software, so many of the other software also based on GCC. It mostly includes the software that is created in C and compiles through GCC.
Among the number of countries, the GCC is maintained by a diversified group, and changes get managed by a committee. This principle gives you excellent compiler that will work on some architectures and diverse environment. The GCC also added the more languages, optimisations, targets, and increase the speed of debugging cycles.
GCC has a wide variety of instruction set of architectures extensively used as a tool in the development of free and proprietary software. It is also available in embedded systems and targets a wide variety of platforms.
GCC has a lot of plugins that extend the GCC compiler. Through plugins, a developer can add, replace, or remove middle end passes operating system on Gimple representation. The Python plugin of GCC invokes arbitrary Python script from inside the compiler. The MELT plugin allows high-level Lisp language to extend GCC.
For a compilation of C, program GCC use the following command
gcc program.c -o binary
Here program.c is the C source file name where the binary is the object file executed.
g++:
The GNU provide the optimising compiler for C++ which is known as g++. It runs on a variety of processor, and you can find full documentation under Emacs. Same as the GCC the g++ contain the separate program. Through this compiler, all language uses the common internal structure that consists of a language-specific front end which parses the programs and creates the abstract syntax tree and backend.
g++ is mainly design for compiling C++ programming language. It is the main compiler in a different operating system such as Linux, BSD, and MAC OS X. It is freely available software and supports many of the free software that is created in C++ programming language and compiles using the g++.
If you want to compile the C++ file, then you will need the g++ compiler with a filename containing the C++ code. If your file does not contain any error, then it will become the executable file.
g++ is the powerful compiler and provides you with many possible options. The g++ browses the documentation section and from command prompt to see the documentation that shipped with your version of g++
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. This compiler builds the object code from source code, and it does not generate any intermediate C version of the program. g++ is a complete compiler and have a different front end and calls the same back end.
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 compiling the C++ program, the 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.
Summary:
This article gives the difference between GCC and g++. Here GCC is a compiler used for C language compilation whereas g++ is a compiler used for C++ programming language. g++ compiler builds the object code from source code, and it does not generate any intermediate C version of the program. g++ is a complete compiler, but GCC requires the help of g++.
- Top 6 SEO Tools to Boost Your Business - January 18, 2024
- Top PHP interview questions and answers 2020 - July 7, 2020
- How to create a Whatsapp account using the Australian number? - June 28, 2020