GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Oct 01, 2014 3:59 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: multiple static libraries
PostPosted: Thu May 15, 2008 4:54 pm 
Offline
Never Seen the Sunlight

Joined: Thu Jun 14, 2007 11:02 pm
Posts: 923
Location: Falun, WI USA
Hi,
maybe I'm just having a brain lapse, but this is really getting to me, so I figured I'd ask for help.

I have two static libraries (libncString, libncUI), libncUI calls functions from libncString.
In my testing program, if I call a function in libncUI that depends on libncString, it will give undefined reference errors, but if I call an ncString function somewhere in my test program, it compiles and runs just fine.

examples:
Code:
/* this one fails to link */
/* nc_menu_add_menu() calls nc_strip_char(), which is in libncString */
nc_menu_add_menu(&NC_MENUBAR(mbar)->mdat, "/", "File");


Code:
/* this one links and runs fine */
nc_strip_char("test", 't');
nc_menu_add_menu(&NC_MENUBAR(mbar)->mdat, "/", "File");


if I'm missing something, I'd really appreciate some help.
Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 7:05 pm 
Offline
Never Seen the Sunlight

Joined: Thu Jun 14, 2007 11:02 pm
Posts: 923
Location: Falun, WI USA
okay, it turns out it was just an error in my link command (-lncString wasn't in the spot it should have been).
however, I'm still curious as to why it compiles fine if I have a call to an ncString function in my test program.
Thanks...


Last edited by dreblen on Thu May 15, 2008 7:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 7:07 pm 
Offline

Joined: Sun Oct 21, 2007 4:00 pm
Posts: 4
Try reversing libraries in your make file. If I understand you well, I think
this is documented feature of linkers - they are optimizing unused code.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 7:16 pm 
Offline
Never Seen the Sunlight

Joined: Thu Jun 14, 2007 11:02 pm
Posts: 923
Location: Falun, WI USA
yes idelovski, that was the problem, I looked up gcc linker options ( http://gcc.gnu.org/onlinedocs/gcc-3.4.6 ... nk-Options ) and corrected it.
Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group