jmasterx jmasterx - 6 months ago 35
C++ Question

std::string == not working?

When I do:

std::string name = targetBone->getName();
if(name == "Pelvis")

I get:

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

How do I resolve this error ?



Have you included string in your cpp file

#include <string>

This usually happens because the compiler need to see the definition of string class that resides in that included file to verify that it indeed declares an operator that takes a char*