elliott.david 2018-11-05 06:18 采纳率: 25%
浏览 174

链接到 c 语言中的静态库

Hi I'm a beginner in C and Linking, I was reading a book that has a question in linking with static library:

Let a and b denote object modules or static libraries in the current directory, and let a→b denote that a depends on b, in the sense that b defines a symbol that is referenced by a. For each of the following scenarios, show the minimal command line (i.e., one with the least number of object file and library arguments) that will allow the static linker to resolve all symbol references:

p.o → libx.a → liby.a and liby.a → libx.a →p.o

and the answer given by the book is:

gcc p.o libx.a liby.a libx.a

I'm confused, shouldn't the answer be :

gcc p.o libx.a liby.a libx.a p.o

otherwise how the undefined symbol in libx.a resolved by p.o?

转载于:https://stackoverflow.com/questions/53149260/linking-with-static-library-in-c

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大