C++ problem , string.h not functioning properly
Supposing i have a sample problem as follows :-
#include <string.h> #include <iostream> int main() { string test; test= "this is a test"; cout<<name; return 0; } and save it as test.cc on compiling it the following error occurs :-- test.cc: In function `int main()': test.cc:5: `string' undeclared (first use this function) test.cc:5: (Each undeclared identifier is reported only once for each function it appears in.) test.cc:5: parse error before `;' token test.cc:6: `name' undeclared (first use this function) test.cc:7: `cout' undeclared (first use this function) but the string.h file is in the /usr/share directory what could be the problem pls help |
use <string> instead of <string.h> you will probably need to add some stuff
like std::cout I believe |
using namespace std;
|
thanx man, it worked
|
|
All times are GMT -5. The time now is 04:24 PM. |