LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-28-2005, 06:24 PM   #1
Nightfox
Member
 
Registered: Jun 2004
Location: Hillsboro, Oregon, USA
Distribution: Mint
Posts: 41

Rep: Reputation: 15
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?
 
Old 10-28-2005, 06:33 PM   #2
naf
Member
 
Registered: Oct 2005
Location: Chicago, USA
Distribution: Slackware & Fedora
Posts: 66

Rep: Reputation: 15
Is there anything special that distinguishes these classes? Are they templates or abstract classes?
 
Old 10-28-2005, 06:43 PM   #3
Nightfox
Member
 
Registered: Jun 2004
Location: Hillsboro, Oregon, USA
Distribution: Mint
Posts: 41

Original Poster
Rep: Reputation: 15
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference to WxGtk libraries when compiling Xchm Darwish Linux - Software 0 09-03-2005 11:11 PM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM
Qt 3.3.3 undefined references when linking Ch. 7 tutorial QtCoder Programming 3 11-07-2004 11:59 AM
Undefined references when linkin against Debian packaged libs stackoverflow32 Programming 3 08-08-2004 02:09 PM
why compiler gives undefined references on static members??? Hano Programming 8 06-26-2002 11:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration