VS2010错误error C2678

之前用的好好的,今天整理了一下工程,删除了一些没用到的.h和.cpp文件,重新编译,发生错误:

error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)

代码定位在if语句里:

string filetype = tmp.substr(pos+1, tmp.length()-pos);

	//strupr() c
	transform(filetype.begin(), filetype.end(), filetype.begin(), toupper); //C++提供的字母小写转大写
	char node[64] = {0};
	if (filetype == "JPG" || filetype == "BMP" || filetype == "PNG" || filetype == "DIB" ||
		filetype == "JPEG" || filetype == "JPE" || filetype == "GIF" ||
		filetype == "TIF" || filetype == "TIFF" || filetype == "JFIF")
	{
		strcpy_s(node, "PIC_FILE_CONFIG");
	}
filetype == "JPG" || filetype == "BMP" || filetype == "PNG" || filetype == "DIB" 
添加了#include ,问题依旧。

添加#include ,问题解决。

string是c++字符串标准库类,string.h是c语言的字符串类



你可能感兴趣的:(C/C++,问题集锦)