Mail Archives: djgpp/2000/02/10/02:11:48
I know that everybody and their mother has already complained at some
point about not being about to link to a library, but I really couldn't
resist - I have read every FAQ and mail archive I could find about the topic,
yet I can't find any specific answers on how to successfully link programs to
a library I have created.
My library consists of header file, MAPS.H, which defines some constants
and some classes, and the other file is souce code, MAPS.CPP, which includes
MAPS.H and defines all of the member functions declared in MAPS.H. The
library builds perfectly into LIBMAPS.A.
However, problems begin when I try linking this library to my game. The
game includes MAPS.H, the library is checked off and spelled correctly (minus
the "lib" part, just "maps") since I'm using RHIDE, it's located in the
correct directory, and the program compiles fine, but come the linking stage
I get several "undefined reference" errors of my class member functions that
are defined in the library.
I've tried linking the program from the command line and it gives me the
same errors, so I dont think anything is wrong with RHIDE. I've tried adding
the library to my project (instead of checking it off in the Library menu)
but that didnt do anything. I'm pretty sure there's nothing wrong with my
code because if I put the same member function definitions and constants
directly into my one program source file instead of trying to link to the
library, the program builds and runs perfectly.
I'm very stumped and I would hate to continue developing my game having
to re-compile EVERYTHING each time, so any help that anybody could give would
be greatly appreciated. Thanx!
-Kevin
- Raw text -