Eclipse抱怨:“无效的'endl'重载' - 但代码确实编译 [英] Eclipse complains: "Invalid overload of 'endl'" - but code does compile

查看:596
本文介绍了Eclipse抱怨:“无效的'endl'重载' - 但代码确实编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个运算符<<对我的模板类:

 模板< class T& 
std :: ostream& operator<<<(std :: ostream& strm,const MyClass< T>&obj)

和我写

  cout< myClassInstance<< endl; 

这个编译和运行,但我的Eclipse CDT说:


'endl'无效的重载


为什么告诉我? p>

(我使用Eclipse CDT Kepler在Win7 64位上使用Cygwin gcc)

解决方案

这确实是Eclipse CDT的一个错误(更具体地说是Eclipse的代码分析工具CODAN)。有错误报告,它已被固定,并应于2014年2月到期的CDT 8.3.0提供。


I've written an operator<< for my templated class:

template<class T>
std::ostream& operator<<(std::ostream &strm, const MyClass<T> &obj)

and when I write

cout << myClassInstance << endl;

this compiles and runs, but my Eclipse CDT says:

Invalid overload of 'endl'

Why does it tell me that?

(I use Eclipse CDT Kepler on Win7 64bit with Cygwin gcc)

解决方案

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.

这篇关于Eclipse抱怨:“无效的'endl'重载' - 但代码确实编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆