Mail Archives: djgpp/1998/09/18/00:15:34
>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 -