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

简单程序

#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”去掉,则错误消失,能够正常运行!

发表于 @ 2007年06月07日 13:30:00|评论(loading...)

新一篇: error LNK2001: unresolved external symbol "__declspec(dllimport) class  | 旧一篇: error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj) 等错误

Csdn Blog version 3.1a
Copyright © gengxt2003