【发布时间】:2013-07-14 12:27:38
【问题描述】:
我为我的模板类编写了一个运算符
template<class T>
std::ostream& operator<<(std::ostream &strm, const MyClass<T> &obj)
当我写作时
cout << myClassInstance << endl;
这编译并运行,但我的 Eclipse CDT 说:
'endl' 的重载无效
为什么会这样告诉我?
(我在 Win7 64bit 上使用 Eclipse CDT Kepler 和 Cygwin gcc)
【问题讨论】:
-
这可能是一个索引问题。尝试重建索引并检查
Window下的索引设置 →Preferences→C/C++→Indexer -
@JesseGood:设置看起来不错,但重新索引没有帮助。
-
信息不足,无法提供更多帮助。
-
记住eclipse不能完全解析c++
-
@JesseGood:我遗漏了什么吗?
标签: c++ templates operator-overloading eclipse-cdt