Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to ubuntu and I want to code in C++. I intalled g++ through software manager and after I installed netbeans to have a nice IDE to code in C++. Then I write this simple code:

#include <iostream>
//using namespace std;

int main(int argc, char**argv) {
    // Prints welcome message...
    std:: cout << "Welcome ..." << std::endl;

    // Prints arguments...
    if (argc > 1) {
        std::cout << std::endl << "Arguments:" << std::endl;
        for (int i = 1; i < argc; i++) {
            std::cout << i << ": " << argv[i] << std::endl;

    return 0;

When I built the code I got this error:

/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'

This meaning that isn't my code in error bu It seems that iostream refer something that is unknown.

Now, my question is: how I can check if gcc and g++ are installed correctly? And, if it is installed well, why g++ doesn't compile?

share|improve this question
sudo apt-get install g++-multilib This should solve your problem. – cxdf Dec 28 '13 at 22:24
error is still present , I think it depends by netbeans IDE .I am going to close this question – user228140 Dec 28 '13 at 23:41
Can you try to compile with g++ from the terminal? – cxdf Dec 29 '13 at 4:00
up vote 2 down vote accepted

It is very strange. You need open "Project Properties" window and change Build|Linker|Tool from gcc to g++


p.s. I have no probs compiling code with g++, while I get same kind of errors trying with gcc.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.