help-gplusplus
[Top][All Lists]
Advanced

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

Re: string class library issues


From: Robert Heller
Subject: Re: string class library issues
Date: Wed, 12 Jul 2006 22:53:27 +0200

At Wed, 12 Jul 2006 03:51:15 -0700 "Mike Dunlavey" <mdunlavey@pharsight.com> 
wrote:

> 
> I am a new user of GCC on Windows.  The version I have is 2.95.2.
> I cannot get this simple file (called test.cpp) to link, due to library =
> problems.
> 
>       #include <strclass.h>
>       //#include <string>
> 
>       void main (int argc, char **argv){
>               string s =3D "Some String";
>       }
> 
> the error from the linker is this:
> 
>       c:/ccbPZonM.o(.text+0x2f):test.cpp: undefined reference to =
> `String::String(char const *)'
>       c:/ccbPZonM.o(.text+0x4f):test.cpp: undefined reference to =
> `String::~String(void)'
>       c:/ccbPZonM.o(.text+0x6a):test.cpp: undefined reference to =
> `String::~String(void)'
>       collect2: ld returned 1 exit status
> 
> If I try the '#include <string>' statement instead of strclass.h, I get =
> a much more longer
> and less helpful list of unresolved references.
> 
> I have tried looking for the string class in all the .a files that come =
> with GCC, without
> success.

The (old) 'String' class is long depreciated.  You must be reading some
really old documentation.  What you want to use is the STL template class
'basic_string', which is somewhat simular.

Oh, main() returns an int, not void.

> 
> I would appreciate any help.
> Thanks
> 
> 
>             

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
heller@deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk
                              


reply via email to

[Prev in Thread] Current Thread [Next in Thread]