When I compile my projects and check the resources used by running top
, the big CPU/memory hog is sometimes called g++
and sometimes cc1plus
. What is the difference between the two, and should I ever call cc1plus
directly?
cc1 is the internal command which takes preprocessed C-language files and converts them to assembly. It's the actual part that compiles C. For C++, there's cc1plus, and other internal commands for different languages.
cc1 is also referred to as the compiler proper. cc1 preprocesses a c translation unit and compiles it into assembly code. The assembly code is converted into an object file with the assembler. Earlier versions of cc1 used /usr/bin/cpp for the preprocessing stage.
Difference between gcc and g++ Both are the compilers in Linux to compile and run C and C++ programs. Initially gcc was the GNU C Compiler but now a day's GCC (GNU Compiler Collections) provides many compilers, two are: gcc and g++. gcc is used to compile C program while g++ is used to compile C++ program.
use of gcc does not add the C++ library. g++ is a program that calls GCC and automatically specifies linking against the C++ library. It treats . c, .
What is the difference between the two,
The g++
is a compiler driver. It knows how to invoke the actual compiler (cc1plus
), assembler and linker. It does not know how to parse or compile the sources.
and should I ever call cc1plus directly?
No.
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