Hello. I am trying to convert my chat client from a C++ program that runs in DOS into one that runs in a Windows Dialog. I am using Visual C++. However, I am already getting a strange error:

#include <string>

That links without error, but when I try to use in a function

string meh = first;

{I was feeling particularly uncreative in naming my strings that day}
I get the error that "string is an undeclared identifier."

Well, personally, I thought I just defined it! All of this code worked just fine in my DOS client program.

Recommended Answers

All 5 Replies

add a 'using namespace std' at the top and see if it makes a difference.

or code as std::string meh = first;

Hmm... that worked. I thought when I had had that there before, it had said "std is not a namespace". Strange. Thanks!

I suppose that would also work, Dragon. I am reading a Java book, and I guess I am just forgetting some of the language-specific features.

I am reading a Java book,.

why would you read a java book to learn c++ :eek: :eek: Does that imply I can learn java by reading a c++ book :?:

why would you read a java book to learn c++ :eek: :eek: Does that imply I can learn java by reading a c++ book :?:

No, I meant that before I had been reading a Java book, to learn Java. I can understand the confusion. Reading a Java book and doing a C++ project. Well, it may not be the wisest idea but at least I can keep fairly up-to-date in both languages :P

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.