Linking a library and source file into another library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm creating a library (say libraryA) that uses another library (say
libraryB).

In source for libraryA I've included the header file for libraryB.
I've also added the directory path of libraryA and libraryB in ld.so.conf.

I compile the source of libraryA as follows:

gcc -c libraryAsource.c -o libraryAsource.o

And then I create libraryA:

ar rcs libraryA.a libraryAsource.o

But when I use libraryA in an application (say testapp) it gives me an
error:

libraryA.a (libraryAsource.o): In function 'libraryAfunction':
libraryAsource.c:(.text+0xe): undefined reference to 'libraryBfunction'


It is funny that I don't get this error when I compile libraryA but only
when I compile testapp that uses libraryA.

I guess the problem lies with the way I'm creating libraryA, since libraryA
uses libraryB. But I don't know how to solve the problem.

Any ideas or suggestions please.
-- 
View this message in context: http://www.nabble.com/Linking-a-library-and-source-file-into-another-library-tp17052050p17052050.html
Sent from the gcc - Help mailing list archive at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux