I'm trying to write a simple little program using strings (which used to work fine) in project builder, but I can no longer get strings to work. Here's an example of code that used to compile for me, but now doesn't:
NOTE: assume there are "<" and ">" around each header file. (I couldn't get the names of the header files to show up with them in the actual code.)
With g++ on some linux boxes at school, this compiles. With gcc, it doesn't.
With project builder (at home), this doesn't compile because it uses gcc. How do I achieve the functionality of the above program with project builder (and preferably using string.h)?
here are the errors from trying to compile this with project builder (gcc):
main.cpp: In function `int main()':
main.cpp:9: `string' undeclared (first use this function)
main.cpp:9: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:9: parse error before `;' token
main.cpp:11: `filename' undeclared (first use this function)
click here to e-mail me
also, I'm running 10.2.3
-Thanks
NOTE: assume there are "<" and ">" around each header file. (I couldn't get the names of the header files to show up with them in the actual code.)
Code:
#include iostream.h
#include cstdlib
#include stdio.h
#include string
#include fstream.h
int main()
{
[B] string filename;[/B]
cerr << "document: ";
[B]cin >> filename;[/B]
cout << "the document was: " << filename << endl;
}
With g++ on some linux boxes at school, this compiles. With gcc, it doesn't.
With project builder (at home), this doesn't compile because it uses gcc. How do I achieve the functionality of the above program with project builder (and preferably using string.h)?
here are the errors from trying to compile this with project builder (gcc):
main.cpp: In function `int main()':
main.cpp:9: `string' undeclared (first use this function)
main.cpp:9: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:9: parse error before `;' token
main.cpp:11: `filename' undeclared (first use this function)
click here to e-mail me
also, I'm running 10.2.3
-Thanks