delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/12/01:01:54

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Undefined Reference...
Date: Fri, 12 Dec 1997 00:21:33 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 56
Message-ID: <3490838D.83E@cs.com>
References: <348F1BA6 DOT 131D AT internet-zahav DOT net>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp202.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Arie Ori wrote:
> 
> Hey all.
> When I compile my program in the RHIDE it returns no errors, but when I
> try to link it (it uses "gcc -o file.exe file.o") it returns an
> "undefined reference" error from all of the included functions and
> variables. Doesn anybody know why?
> Please send copy of ur answers 2 my E-Mail : oriarie AT internet-zahav DOT net

You say, "all of the included functions and variables."  This doesn't
help us as we have no idea what functions and variables you are using.

If you are using code from the standard DJGPP libraries, then RHIDE is
not finding them because of one of two things:

1) Your DJGPP environment variable is not pointing to the correct
location of 'djgpp.env' (see 'readme.1st' or chapter 8 of the FAQ).
2) You are compiling C++ code and are missing the required C++ libraries
(see 'readme.1st' or chapter 8 of the FAQ).
3) You are compiling C++ code but not giving your program a valid C++
extension (.C, .cc, .cpp, .cxx).  Remember that gcc is case-sensitive.

If you are using non-standard code, or code that you have written
yourself, then you must find the libraries that contain that code and
instruct RHIDE to link them into your program.  If the libraries are in
a standard library location (%DJDIR%/lib, etc.), then you can simply go
to Options|Libraries, type in the base name of the library (without
leading "lib" or trailing ".a") in a free space, and check the box to
include it.  If the library is in a nonstandard directory, or does not
have a standard name, then there are other ways to link it; see the
RHIDE docs.

If you are trying to use code that was written for a different compiler
(Borland, Watcom, MSVC, etc.), then you must port it to DJGPP.  Without
more details, I can't give you specific advice, but most such code will
not work as-is with DJGPP.  See chapter 17 of the DJGPP FAQ
(v2/faq210b.zip or online at http://www.delorie.com/djgpp/v2faq/) for
more information on porting old code to DJGPP.

If all else fails, please post the smallest program that fails to
compile, along with a complete RHIDE bug report, or a system report as
outlined in chapter 6.12 of the FAQ.

hth

P.S.:  Undefined references may also be accompanied by implicit
declarations.  You should check the '-Wall' compiler option; it gives
you additional diagnostic information when compiling programs.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Sin lies only in hurting other      |
|       aka Fighteer I       | people unnecessarily.  All other     |
|   mailto:fighteer AT cs DOT com   | 'sins' are invented nonsense."       |
| http://www.cs.com/fighteer |                 - Lazarus Long       |
---------------------------------------------------------------------

- Raw text -


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