Sign in to follow this  
Habba

Error C2061: syntax error

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this