www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/05/22:17:42

From: "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ undefined referance error
Date: Thu, 5 Feb 1998 15:22:56 -0800
Organization: Hewlett Packard
Lines: 35
Message-ID: <6bdhk8$gjg$1@rosenews.rose.hp.com>
References: <34DA3361 DOT EBDD575 AT megsinet DOT net>
NNTP-Posting-Host: ros51675cra.rose.hp.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Pat wrote in message <34DA3361 DOT EBDD575 AT megsinet DOT net>...
>Hello, could someone please tell me why djgpp won't compile this code?
Cockpit Error.

>I downloaded the c++ libraries again and the c++ executable and made
>sure to end my file with *.cpp.
Actually, its probably wiser to use *.cc instead of *.cpp

> Also, I checked the faq but I couldn't
>find anything about this.
Did you really?  Its pretty easy in the section about compile and link
errors under undefined externs.

8.7 Unresolved externals when linking programs
==============================================

**Q*: Why do I get so many unresolved symbols when linking my programs?*

*A* :  By default, GCC instructs the linker to only look in two libraries:
`libgcc.a' and `libc.a.'  Some functions aren't included there, so the
linker
can't find them.  If you need to link against some optional library, say
`libxy.a', put the library into the DJGPP `lib/' subdirectory and append a
`-lxy' to the link command line.  To use C++ classes in the `libgpp.a' (it's
called `libg++.a' on Unix systems), append `-lgpp.'  The Standard C++
Template classes are in `libstdcx.a' (it's called `libstdc++.a' on Unix);
append `-lstdcxx.'

When linking C++ programs, you can use the `gxx' command instead of `gcc';
it
will then instruct the linker to also scan the C++ libraries automatically,
so you don't have to remember doing that yourself.


- Raw text -


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