Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

error C2065: 'String' : undeclared identifier

Started by Xeile Oct 16, 2004 at 1:54 PM 6 replies 39.9k views
Original Post
Xeile
Xeile
I'm using MS Visual C++ 6.0 I'm want to use strings in my application, but I get the error: "error C2065: 'String' : undeclared identifier". I have string.h included in my application, but still is it moaning about the issue undeclared identifier. Can someone help me out please?
Doggan
Doggan
std::string StringName;
twanvl
twanvl
string.h contains the C string functions (strcmp, strcat, etc.) The C++ string header is , the string class is called std::string
Xeile
Xeile
Now I get this error: "error C2653: 'std' : is not a class or namespace name"

What to include for this?
Woodsman
Woodsman
And as Doggan pointed out you need to let the compiler know which namespace it is in. (Unless you using "using namespace std;" which is generally considered bad style.)
If a plant cannot live according to its nature, it dies; so a man.
Xeile
Xeile
Whenever I trying to place "using namespace std;" I says: "error C2871: 'std' : does not exist or is not a namespace"
pi_equals_3
pi_equals_3
Quote:
Original post by Xeile
Now I get this error: "error C2653: 'std' : is not a class or namespace name"

What to include for this?

#include

std::string myStringYay;

or...

#include

using namespace std;

string myStringYay;
Xeile
Xeile
Quote:
Original post by pi_equals_3
Quote:
Original post by Xeile
Now I get this error: "error C2653: 'std' : is not a class or namespace name"

What to include for this?

#include

std::string myStringYay;

or...

#include

using namespace std;

string myStringYay;


Thank you the first example worked.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.