-   Programming (
-   -   Undefined references with static libraries (

Nightfox 10-28-2005 06:24 PM

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:
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?

naf 10-28-2005 06:33 PM

Is there anything special that distinguishes these classes? Are they templates or abstract classes?

Nightfox 10-28-2005 06:43 PM

No, all of the classes are instantiable and usable. I have been able to use them in the test programs for the library, but those aren't compiled against the library file, just the object files. And all of the object files seem to be included in the library file when it's created.

All times are GMT -5. The time now is 03:52 PM.