Re: string class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You need to specify the namespace for the string (which happens to be std).

There are two options:

include<string.h>
 
 int main()
{
  std::string s1("hello world");
 
 return 0;
}

or

include<string.h>

using namespace std;

int main()
{
 string s1("hello world");

return 0;
}

Chris



----- Original Message ----- 
From: "Wim Verleyen" <verleyen.wim@xxxxxxxxxx>
To: <gcc-help@xxxxxxxxxxx>
Sent: Friday, June 04, 2004 7:08 PM
Subject: string class


> Hello,
> 
> I try to compile following C++ program on gcc/g++ version 3.3.
> 
> include<string.h>
> 
> int main()
> {
> string s1("hello world");
> 
> return 0;
> }
> 
> make gives me:
> 
> -  string undeclared (first use in this function)....
> 
> plz help me...
> 
> Wim
> 
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux