I'm creating a project that holds a header file and a cpp file for a custom string class. The cpp file is giving me these errors
myString.cpp|11|error: redefinition of 'std::ostream& operator<<(std::ostream&, const myString&)'
myString.cpp|11|note: 'std::ostream& operator<<(std::ostream&, const myString&)' previously defined here|
this is the header friend std::ostream& operator<<(std::ostream&, myString const&);
this is the function
std::ostream&operator<<(std::ostream& input, myString const& rhs)
{
input << rhs.strVar;
return input;
}
However, it's also giving this error for every function in my myString class. I've seen threads explaining to use include guards but I've had that since the beginning. Any suggestions?
Aucun commentaire:
Enregistrer un commentaire