Ubuntu under the GCC compiler appears undefined reference to ' std::ios_base::init::init () ' Problem

Source: Internet
Author: User

The online explanation is: "You need to add-lstdc++, or using ' g++ ' rather than ' gcc ' as your driver program." That is, if you want to use the g++ compiler, then you need to add "- Istdc++ ".

I tried it, and when I added "-istdc++" to the link, there was no problem.

About g++, reminds me, in Ubuntu the next beginning installs the Code::Blocks, the prompt needs installs the g++. Originally Code::Blocks built-in compiler used is the g++, but why in the construction project, the prompt use of the compiler is GCC??

This leads to the question: "What are the differences and connections between GCC and g++?" "Searching the internet for GCC and g++" (http://www.yuanma.org/data/2007/0406/article_2498.htm), there are a few useful pieces to sort out:

(1) Both GCC and g++ are a compiler for the GNU (Organization).

(2) programs with the suffix. C and the. CPP program g++ are treated as C + + source programs. GCC does not, GCC will process the. C program into a C program.

(3) for the. CPP program, compilation can be used gcc/g++, and links can be used g++ or gcc-lstdc++. (Personally think this is the most important)

Ubuntu under the GCC compiler appears undefined reference to ' std::ios_base::init::init () ' Problem

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.