Differences between GCC and G ++

Source: Internet
Author: User
What is the difference between GCC and G ++? I searched for it online and then again. There are a lot of strange ideas from around the world. Please read the document directly ..

Quote:" The use Gcc Does not add the C ++ library.
G ++ Is a program that callgcc and treats' . C ',
` . H And' . I 'Files as C ++ source files instead of C source
Files unless -X Is used, and automatically specifies linking
Against the C ++ Library "(BTW: C ++ header files under GCC generally use. HH)

Add the parameter-V (verbose mode) during GCC and G ++ compilation. You can see that they connect to these libraries by default:
G ++:-lstdc ++-lm-lgcc_s-lgcc-LC-lgcc_s-lgcc
GCC:-lgcc-lgcc_eh-LC-lgcc-lgcc_eh

Therefore, the difference between GCC and G ++ lies in the processing of the default filetype. If G ++ is used, pay attention to the extension or add the extern "C "; another important point is that G ++ equals gcc-lstdc ++ during connection.

BTW, about extern "C": If C and C ++ libraries are mixed, or you want to writeCodeAfter compiling different C ++ compilers, the first problem is name mangling. For more information, see explore C ++ to explain extern "C ".

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.