lundi 26 octobre 2015

Visual Studio detecting Operater Overloading While g++ doesn't

I have a house class. I initialize a new house element with house house; then I pass data into it and then I cout it:

cout << house;

Couting house works just fine in Visual Studio, but for some reason, I receive this error when I try to compile with g++:

error: cannot bind ‘std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’

Even though I very clearly have this in one of my header files:

friend std::ostream& operator<< (std::ostream& out, house);

Any feedback you can give would be greatly appreciated, as I can see no reason for g++ not being able to see my operator overloading function.

Aucun commentaire:

Enregistrer un commentaire