Redian新闻
>
C++ 诡异的编译问题。请教。
avatar
C++ 诡异的编译问题。请教。# Linux - Linux 操作系统
h*y
1
编译生成了一个库,libcore.a
其中有 util.cc.o
但是 我用 nm -A libcore.a|grep util.cc.o|grep functionA 找不到util.cc定义的
functionA()
这导致在最后link时候用到libcore.a这个库时候 undefined reference to 这个
functionA()的错误
生成libcore.a过程完全正常,没有错误发生。
在另外一台电脑上完全正常,可以nm后可以找到这个函数的。
太诡异了。请指教!
avatar
a*i
2
Maybe util.cc.o depends on some library libHEHE.so, and that file does not
exist on your machine.

【在 h**********y 的大作中提到】
: 编译生成了一个库,libcore.a
: 其中有 util.cc.o
: 但是 我用 nm -A libcore.a|grep util.cc.o|grep functionA 找不到util.cc定义的
: functionA()
: 这导致在最后link时候用到libcore.a这个库时候 undefined reference to 这个
: functionA()的错误
: 生成libcore.a过程完全正常,没有错误发生。
: 在另外一台电脑上完全正常,可以nm后可以找到这个函数的。
: 太诡异了。请指教!

avatar
h*y
3
那为什么不发生错误啊。
而且我回文件夹去找那个util.cc.o,用nm查看 里面是有 functionA的,
但为什么链接到 libcore里面就没有了呢。
于是,最后要用到 libcore.a链接时候,我把util.cc.o跟在后面,链接就成功了。。。
奇怪啊奇怪

【在 a*****i 的大作中提到】
: Maybe util.cc.o depends on some library libHEHE.so, and that file does not
: exist on your machine.

avatar
I*a
4
你那个函数没忘了
extern "C"?
avatar
h*y
5
应该是没有问题的,因为在别的电脑上是好的
而且util.cc.o也是对的。。

【在 I*a 的大作中提到】
: 你那个函数没忘了
: extern "C"?

avatar
q*d
6
Likely there is something not right when .a is created or modified
if possible delete and re-build .a to see if it is the cuase or
use ar tv libcore.a and see if util.cc.o is listed and is the latest one
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。