At Wed, 12 Jul 2006 03:51:15 -0700 "Mike Dunlavey" <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]       -- Contract Programming: C/C++, Tcl/Tk
                              
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to