Puzzling errors

I'm experiencing error c2678 in my header file. I'm suffering this in many places, but I'll only show you the first error's relevant code:

#include<iostream>
#include<ctime>
#include<time.h>
#include<cstdlib>
#include<windows.h>
class whatever{
public:
std::string line;
//some other variables
};
int someFunction(int num, std::string text, whatever &whatever1/*object of class whatever*/, std::string arrayOfStrings[]){
if(text == whatever1.line)//the error is on this line
{
//some more code
}
//some more code
return 0;
}

The error message reads exactly: "binary '==' : no operator defined which takes a left-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::a
llocator<char> >' (or there is no acceptable conversion)"

I hope I didn't make some kind of stupid error, but whether it's a stupid error or not, I can't figure it out. Can anybody help?
Try adding this line
 
#include <string> 
and if that don't work (but it should), you could use compare() instead of ==

http://www.cplusplus.com/reference/string/string/compare/

Last edited on
Why do you include both ctime and time.h?
Adding #include<string> worked! Thanks, Chervil.
Topic archived. No new replies allowed.