tags:

views:

109

answers:

1

If I wanted to link the following objects and libraries,

p.o → libx.a → p.o

Where a → b denotes that b defines a symbol that is referenced by a.

Would

UNIX% gcc p.o libx.a 

be enough in the command line or do I need to do something like:

UNIX% gcc p.o libx.a p.o

Thanks.

+3  A: 

For the record: if you're using the GNU linker, the perfect solution for you is:

gcc -Wl,--start-group p.o libx.a -Wl,--end-group

FX