chif-ii
chif-ii

Reputation: 1015

Having trouble creating a class in c++

The problem I'm having seems to be that C++ doesn't like me inserting either or into my class. Part of the problem might be that I'm flipping back and forth between Visual Studio 2010 at my house and Visual Studio 2012 on the school computers (to clarify, this is just something I'm writing for fun, not as a school project). Even when I comment out the parts of the program that deal with the string, c++ still doesn't recognize "cout" or "endl", which is frustrating. Spellcheck seems to be wigging out on me, especially when it comes to #ifndef and #endif. Pastebin contains both the class itself and the error message I get when I try to build it.

Class/errors

Upvotes: 0

Views: 34

Answers (1)

Dialecticus
Dialecticus

Reputation: 16761

Compiler does not recognize string so it throws a tantrum. There's std::string though. If this is just one .cpp file the simplest would be to place using namespace std; after the last include.

More proper solution (that you should use in big projects) is to put std:: everywhere it needs to be put (std::string, std::cout...).

Upvotes: 0

Related Questions