Undefined references with static libraries
Hi all.
There's a collection of classes I'm writing, and in the makefile for my project, I have it set up to create a static (.a) library. It builds and installs without any warnings or errors. There's also another project I'm working on that makes use of the library.
The problem I'm running into is that when I try to build the other project, the linker complains that there are undefined references to functions in 2 of the classes from the library.
I've checked my makefile for my library, and I have all the object files listed for the static library file:
$(INSTALL_LIB): $(OBJS)
ar rvu $(INSTALL_LIB) $(OBJS)
ranlib $(INSTALL_LIB)
$(OBJS) contains the list of object files - and it does include the object files for the 2 classes about which the linker complains of undefined references (I'd rather not post all the filenames in my snippets due to copyright reasons, since this is a project for work). When I build the library file, it lists all the object files, including those 2.
Has anyone had a similar problem? Is there any reason why some object files might not be included in a library file? Or am I missing something?
|