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