您的位置:首页 > 运维架构

error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion

2007-06-07 13:30 639 查看
简单程序

#include <iostream.h>
#include <string>
#include <list>
#include <algorithm>

using namespace std;

PrintIt (string& StringToPrint) {
std::cout<<StringToPrint<<endl;
//; cout<<"asdfds"<<endl;
}

int main (void) {
list<string> FruitAndVegetables;
FruitAndVegetables.push_back("carrot");

for_each (FruitAndVegetables.begin(), FruitAndVegetables.end(), PrintIt);
}

如果 #include <iostream.h> 则有错误,
错误如题所示:

error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)

把其中的 “.h”去掉,则错误消失,能够正常运行!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐