开发者

Linking in C using gcc

If I wanted to link the following objects and libraries,

p.o → libx.a → p.o

Where a → b denotes th开发者_运维问答at 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜