Issues getting Win32 string type?


I'm playing around with Visual Studio 2008 and C++. I'm trying to get a program to compile, and so far, no go.

I created the project as a Win32 Console Application. I entered the following simple program:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <string>
#include <ios>
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main()
{
	string name;

	cout << "Please enter a name: ";
	cin >> name;
	cout << "Got <" << name << ">" << endl;

	return 0;
}


I get the error "error C2065: 'string' : undefined identifier

'name' is undefined, so other errors follow.

This is maddening! Any ideas?
there it is, use
" char name[256]; "
instead of string.
I understand that's an option. However, I have a bunch of code that uses this class/type that I want to move over soon, and would prefer to have it work. Also, I'm really curious why it doesn't work and it's not obvious to me.
try to put the
" #include <string> "
after
" #include <iostream> "
then re-compile the original code.
Can't help you nomore on those includes, i'm not an iostream/string maniac.
Nope. Same result.
closed account (DSLq5Di1)
1
2
3
4
5
6
int main()
{
	std::string name;

	cout << "Please enter a name: ";
...
Or preferably, add using std::string;
I appreciate the help.. That totally handled the scene. I'll quit being so dense now....
Topic archived. No new replies allowed.