GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a warning, debugging, linking libraries, object file, etc. The different options of GCC command allow the user to stop the compilation process at different stages.
g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file. The different “options” of g++ command allow us to stop this process at the intermediate stage.
DIFFERENCE BETWEEN g++ & gcc
|g++ is used to compile C++ program.||gcc is used to compile C program.|
|g++ can compile any .c or .cpp files but they will be treated as C++ files only.||gcc can compile any .c or .cpp files but they will be treated as C and C++ respectively.|
|Command to compile C++ program through g++ is
g++ fileName.cpp -o binary
|command to compile C program through gcc is
gcc fileName.c -o binary
|Using g++ to link the object files, files automatically links in the std C++ libraries.||gcc does not do this.|
|g++ compiles with more predefined macros.||gcc compiles C++ files with more number of predefined macros. Some of them are #define __GXX_WEAK__ 1, #define __cplusplus 1, #define __DEPRECATED 1, etc|
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- How to compile 32-bit program on 64-bit gcc in C and C++
- Branch prediction macros in GCC
- How to add "graphics.h" C/C++ library to gcc compiler in Linux
- __builtin_inf() functions of GCC compiler
- Difference between Stop and Wait protocol and Sliding Window protocol
- Similarities and Difference between Java and C++
- Difference between Yaacomo and and XAP
- Difference between VoIP and and POTS
- Difference and Similarities between PHP and C
- Difference between Time Tracking and Time and Attendance Software
- Difference Between Single and Double Quotes in Shell Script and Linux
- Difference Between malloc() and calloc() with Examples
- What is the difference between single quoted and double quoted declaration of char array?
- Difference between "int main()" and "int main(void)" in C/C++?
- Difference between ++*p, *p++ and *++p
- Difference Between DOS and Windows
- Difference between User Level thread and Kernel Level thread
- What’s difference between The Internet and The Web ?
- Difference between Priority Inversion and Priority Inheritance
- What’s difference between Linux and Android ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.