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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 linux驱动,linux应用,多线程