I have a problem with linking together different libraries using it in one executable project.
Let's say Project A contains a function named foo()
; It is compiled as a static library.
Project B contains a function named bar()
, includes a header from A and compiled as a shared library with -Wl
,--whole-archive libA.a -Wl
,--no-whole-archive flags
.
libB.so was moved to /usr/lib
.
Now, project C includes B.h
, calls bar()
, but wasn't compiled due to the reason of undefined reference to foo()
function, which was defined in project A.
nm libB.so
says:
U foo
I am using gcc, the programming language is C, the IDE is Eclipse CDT.
Is anyone who has an idea or tip to solve this problem?
Thank you.