#ifndef BASE_H
#define BASE_H
class Base
{
public:
    int m_nValue;

    Base(int nValue=0)
        : m_nValue(nValue)
    {
    std::cout << "Base" << std::endl;
    }
};
#endif



#ifndef DERIVED_H
#define DERIVED_H
#include "Base.h"
class Derived: public Base
{
public:
    double m_dValue;

    Derived(double dValue=0.0)
        : m_dValue(dValue)
    {
    std::cout << "derived se" << std::endl;
    }
    friend std::ostream & operator << (std::ostream& os, const Derived &d);
    friend std::istream & operator >>(std::istream& is,  Derived &d);
};
inline std::ostream& operator << (std::ostream& os, const Derived &d)
{
    return os << d.m_dValue;
}
inline std::istream & operator >>(std::istream& is,  Derived &d)
{
    return is >> d.m_dValue;
}

#endif



#include <iostream>
#include "Derived.h"
using namespace std;



int main()
{
    Derived d(4.5);
    cout << d;

}

And the error is
$ gcc -std=c++11 -std=c++0x -W -Wall tt1.cpp
/tmp/cc6aQime.o:tt1.cpp:(.text+0x79): undefined reference to std::ios_base::Init::Init()' /tmp/cc6aQime.o:tt1.cpp:(.text+0x79): relocation truncated to fit: R_X86_64_PC32 against undefined symbolstd::ios_base::Init::Init()'
/tmp/cc6aQime.o:tt1.cpp:(.text+0x94): undefined reference to std::ios_base::Init::~Init()' /tmp/cc6aQime.o:tt1.cpp:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against undefined symbolstd::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc6aQime.o: bad reloc address 0x1b in section `.text$_ZN4BaseC2Ei[_ZN4BaseC2Ei]'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status

Can anybody throw a light on the reason of this error message?

You have this

gcc -std=c++11 -std=c++0x -W -Wall tt1.cpp

but should it be

g++ -std=c++11 -std=c++0x -W -Wall tt1.cpp

This question has already been answered. Start a new discussion instead.