This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

String problem when compiling with gcc3.0.2 in an Alpha with Tru64


Hello.
 
Trying to compile a short "Hello World!" program I have had several problems with strings. Here is the source code:
 
#include <iostream.h>
#include <string>
//#include <bits/stringfwd.h>
 
int main ()
{
 cout << "Hola!" << endl;
 
 string pepe;
 pepe = "Hola con string";
 cout << pepe << endl;
 
 return 0;
}
Easy, isn't it? Yhis is what gcc tells me:
 
bash-2.02$ g++302 hello.cpp -o hello.exe
hello.cpp: In function `int main()':
hello.cpp:8: `string' undeclared (first use this function)
hello.cpp:8: (Each undeclared identifier is reported only once for each
   function it appears in.)
hello.cpp:8: parse error before `;' token
hello.cpp:9: `pepe' undeclared (first use this function)
Can somebody help me? I have tried including "bits/stringfwd.h" (where I have found a typedef defining string) but still have the same problem. Somewhere in this mailing list I have read about putting std::string and it seems to work, but the problem is I have to migrate a lot of source files from Linux(Mandrake) where previous program works to Tru64 machine and there are lots of string defined and change all is goiung to be a lot of work, so I hope another way to do this can be possible.
 
Thnaks in advance:
 
Jorge Andreu

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]