简体   繁体   中英

Link static library with static library

I have a Makefile.am with two noinst_LIBRARIES , and one of them needs to link with the other.

Adding it to the CFLAGS throws a compiler warning, but as far as I know, automake likes to freak out about using LDADD with libraries, since they are not complete programs.

How can I do this, assuming libb.a needs to pull in liba.a ?

You can't do it. Actually, what you are trying to do doesn't really make sense. Static libraries are just archives containing object files and a table of contents. Put simply, you can think of a static library as a .zip containing .o files.

The linking phase only takes place when compiling a shared object or executable. When your program is linked against liba.a , you also need to specify -static -lb or similar and that's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM