I am learning about linking and static libraries. In one exercise (from Computer Systems, Bryant - O'Hallaron), I am asked to write the minimal command line that will allow the static linker to resolve all symbol references. Consider
p.o depends on libx.a
libx.a depends on liby.a
liby.a depends on libx.a
libx.a depends on p.o
I wrote:
gcc p.o libx.a liby.a libx.a p.o
but the correct answer is
gcc p.o libx.a liby.a libx.a
Why should the extra p.o not figure in the command line?