I have a C++ application that I inherited, which consists of:
I'll answer your second question first. You can simply use the -H
or -M
flag to see all (including system) headers processed in the compilation. gcc -H main.c
should do the trick. Seeing which headers
are included will actually get you on the right track to finding which static libraries were linked in.
You could use objdump
on your final object (or readelf
on your final binary) to get the names of all the functions in there. You'd then have to go find the libraries from which the functions were pulled in, but that's a bit cumbersome. You'd definitely have to make a script to minimize the pain.
Someone else mentioned using gcc
which simply passes the -verbose
flag to the linker. That's a perfect way to get a list of shared libraries (.so files), but you said yours are static, so that isn't the way to go in this case.
Good luck!