Using "cout <<" when pointing to a class' string member

Hello, dear skilled programmers! I've run into a problem which is too complex for my very elementary skills.

I have a game in which I have a class which contains a member of type string. When I try to use "cout << myclass->string" I get the error message:
"1>c:\users\asus\desktop\programmering\spel\fighting_spel_text\fighting_spel_text\fighting_spel_text.cpp(108): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)"

I'm thinking that the compiler's thinking that I'm trying to convert a string to a string, which it cannot do. I have no idea where to go from here.

Thank you in advance. :)
Did you include <string>?
I did include "string.h". I tried it now with using <string> and it worked. What's the difference?
<string.h> is the C string header that contains functions to work with c strings. <cstring> is the C++ version of the same header with everything inside the std namespace. <string> is a C++ header containing stuff related to the std::string class.
Last edited on
Thank you very much! You've been most helpful!
Topic archived. No new replies allowed.