Eclipse complains: "Invalid overload of 'endl'" - but code does compile

I was getting this error as well.

//print the value
cout << rt->element << endl;

A simple change to:

//print the value
cout << rt->element;
cout << endl;

removed the error for me. New to C++, but it seems like you also need to overload << for myClassInstance. If you want to use the original method.


This is indeed a bug with Eclipse CDT (more specifically Eclipse's Code Analysis tool CODAN). There is bug report and it has been fixed and should be available from CDT 8.3.0 which is due February 2014.