Original Post
I'm using dev c++ to learn c++, but I'm having some problems with strings. My code reads: #include #include #include using std::string; int main() { string name; cout << "Enter name "; cin >> name; cout << "You entered: " << name << endl; system("PAUSE"); return 0; } but when I compile, I get the following errors: c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp: In function
int main()': c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp:9: string' undeclared (first use this function) c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp:9: (Each undeclared identifier is reported only once c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp:9: for each function it appears in.) c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp:9: parse error before ;' c:\docume~1\jorge\mydocu~1\entert~1\progra~1\c__~1\projects\untitl~1.cpp:11: name' undeclared (first use this function) According to the book I'm using (beginning game programming with c++) my code is correct. What is the error then? UPDATE: I tried Fruny's suggestion, and it solved the problem. Thanks for all the responses though. [Edited by - jlg on July 28, 2005 9:01:19 PM]