Re: Linking a library and source file into another library

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

 



* fusion (mcp@xxxxxxxxxxxx) [20080505 00:35]:

> 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'

You have to pass all needed libraries to the compiler, i.e. 
gcc -o app app.o -lrarA -lraryB

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

There isn't anything funny here. External references are only resolved when
creating a binary or a shared library, not when creating a static library.
 
Philipp

[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