Errors:

1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2065: 'string' : undeclared identifier
1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2146: syntax error : missing ';' before identifier 'str'
1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(239): error C2065: 'str' : undeclared identifier

Code: string str;

For some reason strings are giving me errors.

Recommended Answers

All 6 Replies

Maybe strings are giving you errors because you forgot to declare them - just like you forgot to post your code.

Have you included string library ? Try this # include <string>.

I did include the string library. The errors are with that one line. I was thinking I made a small mistake that I didn't notice.

Perhaps a namespace issue? Do you have either of these after the #include <string> line?

using namespace std;
using std::string;

Alternately, you can replace string str; with std::string str;

I accidently erased the using namespace std; while messing with the definitions.
Hahaha, I feel like such an idiot now.

not to worry, happens to everyone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.