日常遇到的难题解析

在linux上使用make指令遇到了 undefined reference 的错误,在网上一番查找之后发现是链接 -l 选项先后的问题,如果 libfight.a 中使用了 libbase.a ,且 game 同时使用了 fight.lib 和 base.lib,正确的链接顺序是 -lfight -lbase ,因为如果后链接fight ,fight中使用的lib函数就没有定义了,所以造成 undefined reference 的错误

猜你喜欢

转载自www.cnblogs.com/noprofessional/p/9544270.html
今日推荐