Mail Archives: djgpp/1998/07/19/18:37:17
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 -