自己刚碰到这样的问题。
库依赖关系是:libA.so依赖libB.so, libB.so依赖libC.so
问题是:libB.so:undefined reference to "Chello:hello(char* pcName)", Chello在libC.so里
解决方法:
1)在A的makefile里,libB.so放在libC.so前
Libs = -L/root/api -lB \
-L/root/public -lC
2)在B的makefile里,g++加上-L/root/public -lC
Libs= -L/root/public -lC
本文介绍了解决库依赖问题的方法,具体地,当libA.so依赖libB.so且libB.so依赖libC.so时,出现“undefined reference”错误。通过调整makefile中库的链接顺序或者在相关makefile文件中加入缺失库的路径可以解决该问题。
2932

被折叠的 条评论
为什么被折叠?



