delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/19/18:37:17

Sender: nate AT cartsys DOT com
Message-ID: <35B24AE0.EAEC22A9@cartsys.com>
Date: Sun, 19 Jul 1998 12:37:04 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Jorge Ivan Meza Martinez <jimeza AT usa DOT net>
CC: djgpp AT delorie DOT com
Subject: Re: problemitas with C++
References: <01bdaedc$cb9f6120$LocalHost AT default>

Jorge Ivan Meza Martinez wrote:
> 
> Hello to everyone,
> 
> I am having problems compiling C++,
> 
> I installed all files that the "zip picker" asked me, but when I compile a
> program the output says that my classes ( standard classes ) are undefined.
> 
> for example, I tried something like
> 
> #include <strclass.h>
> int main ( void )
>     {
>     String cadenita = String ( "cadenota" );
>     }
> 
> I compile with "gcc file.cc -o file.exe", the output says that String
> constructors and destructor are undefined.  I don't include -lgpp because I
> understand that GCC include C++ classes itself.

No, it doesn't.  Linking is independent from compilation, and C is
indistinguishable from C++ at that stage.  Thus, the linker has to be
told to link the C++ libraries (now -lstdcxx).  Add that to the command
line, or better, use the `gxx' or `gpp' command (depending on your GCC
version) to do the link.  Ex:

gpp file.cc -o file.exe

README.1ST explains this.

> I understand that the code defined by the header is in the .a files into the
> /lib directory, isn't it ?

Yes.
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019