I have a C++ application that I inherited, which consists of:
- My main app
- Several app-specific libraries (libapp1, libapp2, etc...)
- Several "third party" libraries (most "third partis are just other teams in the company") linked from both the main app, from the app-specific libappX libraries, and from other 3rd part libraries - e.g. libext1, libext2, etc...
In other words, my code looks like this:
// main.C
#include <app1/a1l1.H>
#include <app2/a2l1.H>
#include <ext1/e1l1.H>
// app1/a1l1.H
#include <app1/a1l2.H>
#include <ext2/e2l1.H>
// app2/a2l1.H
#include <ext2/e2l2.H>
// ext1/e1l1.H
#include <ext3/e3l1.H>
// ext3/e3l1.H
#include <ext4/e4l1.H>
QUESTIONs:
1) How can I tell which libraries have been linked into the final executable? This must include statically linked ones
In other words, I want an answer of "app1, app2, ext1, ext2, ext3, ext4"
Ideally, the answer would be available from the executable itself (I have a debug version of it built in case it makes it more possible). If that's impossible, i'd like to know if there's a simple code analysis tool (iedeally something within gcc itself) to provide that analysis.
Please note that the object files for external libraries are already built, so looking at the build logs to see what was linked, I'm worried that "ext4" won't show up in the log since we won't be building "ext3" library that is already pre-built.
NOTE: running "nmake" with DEPS set to yes to rebuild all the is NOT an option. But i DO have access to the full source code for external libraries.
2) A slightly separate and less important question, how can i tell a list of all the include files used in the entire source tree I'm building. Again, ideally frm already-built executable, which i have a debug version of.
=================
UPDATE: Just to clarify, our libraries are linked statically, so ldd
(List Synamic Dependencies) does not work.
Also, the answer can be either for Solaris or Linux - doesn't matter.
I tried using nm
but that doesn't list the libraries