g++ and GCC and cc differences

Source: Internet
Author: User

1.GCC

GCC represents "GNU Compiler Collection", and GCC is a collection of compilers for the release of several major programming languages that currently include C,c++,objective-c, Java, Fortran, Ada, and go.

GCC has three layers of meaning: (1) as shown above, (2) formerly representing "GNU C Compiler"; (3) GCC's language-independent part: The shared part of all compilers that support languages.

The GCC language-independent section includes most of the optimizer and the backend that generates machine code for different processors.

The part of the compiler associated with a particular language is called the front-end.

In addition to the C language most languages compiler has their own name, C + + compiler is g++, Ada compiler is gnat, etc. when compiling these languages, you can use their compiler names or use GCC.

2.cc

CC is originally the C Compiler of Unix system, under Linux cc is the GCC symbol connection. You can view the following commands:

Ls-l/usr/bin/cc

The result:/usr/bin/cc->/etc/alternatives/cc

Ls-l/etc/alternatives/cc

The result:/etc/alternatives/cc->/USR/BIN/GCC

3.g++ and GCC

There are some differences between the two: the suffix is. C's file gcc as a C program, g++ as a C + + program. Suffixes of C + + are both as C + + programs. For CPP programs, either GCC or g++ compile phase are the same, are compiled with GCC, but in the link phase gcc can not automatically and C + + program use of the library connection, if used, the shape is as follows: GCC helloworld.cpp-lstdc++-O HelloWorld. So we usually use g++ to connect (g++ will automatically connect C + + Common library), so in order to use convenient for CPP program simply compile link all use g++.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.