* RE: string class
@ 2004-06-04 18:42 lrtaylor
0 siblings, 0 replies; 5+ messages in thread
From: lrtaylor @ 2004-06-04 18:42 UTC (permalink / raw)
To: verleyen.wim, gcc-help
Do this instead:
#include <string>
using namespace std;
int main()
{
string s1("hello world");
return 0;
}
Make sure you compile it with g++.
Cheers,
Lyle
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Wim Verleyen
Sent: Friday, June 04, 2004 12:08 PM
To: gcc-help@gcc.gnu.org
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: string class
2004-06-05 13:28 ` llewelly
@ 2004-06-06 20:33 ` Chris Wolstenholme
0 siblings, 0 replies; 5+ messages in thread
From: Chris Wolstenholme @ 2004-06-06 20:33 UTC (permalink / raw)
To: llewelly; +Cc: gcc-help
Yes, I definitely do! That's what happens when you Cut and Paste without
paying attention! :-)
Chris
----- Original Message -----
From: <llewelly@xmission.com>
To: "Chris Wolstenholme" <chris@blueband.demon.co.uk>
Cc: <gcc-help@gcc.gnu.org>
Sent: Saturday, June 05, 2004 2:28 PM
Subject: Re: string class
> "Chris Wolstenholme" <chris@blueband.demon.co.uk> writes:
>
> > You need to specify the namespace for the string (which happens to be
std).
> >
> > There are two options:
> >
> > include<string.h>
>
> You mean '#include<string>' , without the '.h'
>
> >
> > int main()
> > {
> > std::string s1("hello world");
> >
> > return 0;
> > }
> [snip]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: string class
2004-06-04 18:45 Chris Wolstenholme
@ 2004-06-05 13:28 ` llewelly
2004-06-06 20:33 ` Chris Wolstenholme
0 siblings, 1 reply; 5+ messages in thread
From: llewelly @ 2004-06-05 13:28 UTC (permalink / raw)
To: Chris Wolstenholme; +Cc: gcc-help
"Chris Wolstenholme" <chris@blueband.demon.co.uk> writes:
> You need to specify the namespace for the string (which happens to be std).
>
> There are two options:
>
> include<string.h>
You mean '#include<string>' , without the '.h'
>
> int main()
> {
> std::string s1("hello world");
>
> return 0;
> }
[snip]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: string class
@ 2004-06-04 18:45 Chris Wolstenholme
2004-06-05 13:28 ` llewelly
0 siblings, 1 reply; 5+ messages in thread
From: Chris Wolstenholme @ 2004-06-04 18:45 UTC (permalink / raw)
To: gcc-help
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@pandora.be>
To: <gcc-help@gcc.gnu.org>
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
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* string class
@ 2004-06-04 18:08 Wim Verleyen
0 siblings, 0 replies; 5+ messages in thread
From: Wim Verleyen @ 2004-06-04 18:08 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-06 20:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-04 18:42 string class lrtaylor
-- strict thread matches above, loose matches on Subject: below --
2004-06-04 18:45 Chris Wolstenholme
2004-06-05 13:28 ` llewelly
2004-06-06 20:33 ` Chris Wolstenholme
2004-06-04 18:08 Wim Verleyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).