www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/18/00:15:34

From: elvenforst AT aol DOT com (ElvenForst)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: help please
Lines: 28
NNTP-Posting-Host: ladder01.news.aol.com
Date: 18 Sep 1998 04:02:52 GMT
Organization: AOL http://www.aol.com
References: <3601CD58 DOT 7DEF9330 AT globalserve DOT net>
Message-ID: <19980918000252.26170.00000996@ng136.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>What does UNDEFINED REFERENCE mean and how do I fix it?

This is a linker error.  It comes about when a reference in a particular module
is present, and its definition is expected to exist in another module but isn't
found during the linking.  For example,

struct X {
  void y();
};

void f() {
X *x;
x -> y();
}

will compile because the definition of X::y doesn't have to be in the same
module as the declaration of X.  The solution is to be sure that a file with
the definition of X::y is linked into the executable.  This file should have,

void X::y() {...}

in it.  Or, you can just put this into the same file that references the
function, somewhere after the declaration and somewhere before the reference.

--Richard Ellwood
From,
    Richard Scott Lancelot Ellwood,

- Raw text -


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