error C2679: binary '

简单程序

#include
#include
#include
#include

using namespace std;

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

int main (void) {
  list FruitAndVegetables;
  FruitAndVegetables.push_back("carrot");
  
  for_each  (FruitAndVegetables.begin(), FruitAndVegetables.end(), PrintIt);
}
 

如果 #include 则有错误,
错误如题所示:

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

把其中的 “.h”去掉,则错误消失,能够正常运行!

你可能感兴趣的:(错误)