• Advertisement

Archived

This topic is now archived and is closed to further replies.

issue with <string>

This topic is 5094 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well as my message states, I am having an issue and I have no freaking clue as what to do to fix it. I have this in the code. #include <string> class CelistialBase { public: CelistialBase(void); CelistialBase(string inName); // <-- line 10 ... ... ... private: string mName; // <-- line 20 }; and I am recieving these errors: CelistialBase.h(10) : error C2629: unexpected ''CelistialBase ('' CelistialBase.h(10) : error C2238: unexpected token(s) preceding '';'' CelistialBase.h(20) : error C2146: syntax error : missing '';'' before identifier ''mName'' Any thought on some funkey mojo I have to do to make it work in vc7? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster

#include <string>

class CelistialBase
{
public:
CelistialBase(void);
CelistialBase(std::string inName); // <-- line 10

...
...
...
private:

std::string mName; // <-- line 20


};

Share this post


Link to post
Share on other sites
as the AP pointed out, you have to use the full identifier for the string (it is in the STD namespace).

so, you can either use "std::string" instead of just "string", or put a "using std::string;" at the top of your code.

Share this post


Link to post
Share on other sites
although you should never put using in a header file as it would drag the name in for anyone using the header, which is a bit impolite.

Share this post


Link to post
Share on other sites

  • Advertisement