Jump to content
  • Advertisement
Sign in to follow this  
Habba

Error C2061: syntax error

This topic is 4733 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

I'm trying to use string-class with my program, and I've included string.h (#include <string.h>), but I still can't use string-class. I get this error while compiling: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/c2061.asp

Share this post


Link to post
Share on other sites
Advertisement
The other possible problem is that the string class lives in the std namespace, so you should either prefix the string identifier with std:: as in std::string or use a using statement or directive to bring string in from the std namespace. ex: using namespace std; or using std::string;

If that doesn't work for you, you'll probably need to post the code you are trying to compile.

Share this post


Link to post
Share on other sites
It was a namespace issue alright, but first I tried to add "using namespace std", but it didn't work, so I ended to use std::string istead of just string while declaring the class. I guess it's okay then. Thank you all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!