Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Linking referenced project when building a static lib.(Looking for a way to create a static lib which contains the object from a couple ofother referenced projects.)
Linking referenced project when building a static lib. [message #854218] Mon, 23 April 2012 19:35 Go to next message
Sylvain Boily is currently offline Sylvain BoilyFriend
Messages: 9
Registered: February 2012
Junior Member
I currently have the following

lib a (static)
lib b (static)
lib c (reference static a, static b -- wrapper lib)

exec reference lib c (i do not want this project to know about lib a,b)

When I build lib c, as a static lib, I do not get the object of lib a,b packaged within the .a file.

Isn't there a way to achive this ?
Re: Linking referenced project when building a static lib. [message #854769 is a reply to message #854218] Tue, 24 April 2012 08:18 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
I am not sure if this is possible out of the box.
But you can try the following:
1) Open project properties of lib c
2) C/C++ Build->Settings
3) Select GCC Archiver
4) add the the object of lib a,b to the line
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}




Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Linking referenced project when building a static lib. [message #855054 is a reply to message #854769] Tue, 24 April 2012 13:41 Go to previous messageGo to next message
Sylvain Boily is currently offline Sylvain BoilyFriend
Messages: 9
Registered: February 2012
Junior Member
thanks Ill give it a try.

sokmething along those lines:

${workspace_loc:<liba>}/${ConfigName}/liba.a

?
Re: Linking referenced project when building a static lib. [message #855232 is a reply to message #855054] Tue, 24 April 2012 16:20 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Sylvain Boily wrote on Tue, 24 April 2012 15:41
thanks Ill give it a try.

sokmething along those lines:

${workspace_loc:<liba>}/${ConfigName}/liba.a

?

I am not sure if the archiver ar accepts static libs (lib.a) as input. I was thinking about adding the object files (*.o) from liba. But if you have a lot of files that would be a mess ...

Wait, it seems to be possible!
From http://stackoverflow.com/questions/3821916/how-to-merge-two-ar-static-libraries-into-one
Quote:
Or you can simply use the "quick append" option (man ar, look at q or r)
ar q libaz.a libabc.a libxyz.a



Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Linking referenced project when building a static lib. [message #855567 is a reply to message #855232] Tue, 24 April 2012 23:34 Go to previous messageGo to next message
Sylvain Boily is currently offline Sylvain BoilyFriend
Messages: 9
Registered: February 2012
Junior Member
Awesome!

I will be trying this tomrorow, ill update this thread with my finding.

Thanks for your input.
Re: Linking referenced project when building a static lib. [message #857467 is a reply to message #855567] Thu, 26 April 2012 15:08 Go to previous message
Sylvain Boily is currently offline Sylvain BoilyFriend
Messages: 9
Registered: February 2012
Junior Member
no luck, the -r option is already the default option. -q is the same as -r...

Ohh Well.

thanks though for your help.
Previous Topic:From QTCreator to Eclipse
Next Topic:Problem with GSL in Eclipse
Goto Forum:
  


Current Time: Tue Apr 23 12:12:27 GMT 2024

Powered by FUDForum. Page generated in 0.03496 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top