Reputation: 2825
Consider an executable called Exe
, which depends on a static library called Lib1
, and Lib1
depends on another static library called Lib2
, so:
Exe -> Lib1 -> Lib2 (where '->' marks dependency)
Let's say I remove Lib2
from Lib1
's additional library inclusions. In my experience, Lib1
will still compile, but when I'll try to compile Exe
(which is linked to Lib1
), linker errors will occur stating that Lib2
symbols are missing from Lib1
.
Is there a way to "detect" unresolved symbols when compiling Lib1
without needing to resort to compiling Exe
to get notified of the unresolved symbols in the Lib1
? If not, why?
Upvotes: 1
Views: 103
Reputation:
Assuming you are talking about static libraries, then there is no way of doing this. Static libraries do not link to each other. The linker looks for symbols it can't find in the executable in all the static libraries you list on the linker command line in turn. If it finds an unknown symbol in a static library, it then looks in the other static libraries, but the process is driven from the executable (or DLL) that you are linking.
Upvotes: 2