nm:“U";符号未定义 [英] nm: "U" The symbol is undefined

查看:34
本文介绍了nm:“U";符号未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在我的一个库上运行时:

When I nm on one of my libs:

nm libmylib.so

nm libmylib.so

我得到这样的一条线

             U _ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4

我检查了 nm 的手册页,我得到U"符号未定义.未定义符号的真正含义是什么?

I checked the man page for nm and I got "U" The symbol is undefined. What does an undefined symbol really mean?

如果真的是未定义的,那为什么nm会报告呢?

If it is really undefined, then why does nm report it at all?

推荐答案

未定义符号是库使用但未在创建库的任何目标文件中定义的符号.

An undefined symbol is a symbol that the library uses but was not defined in any of the object files that went into creating the library.

通常,符号是在另一个库中定义的,该库也需要链接到您的应用程序.或者,符号未定义,因为您忘记构建定义该符号的代码,或者您忘记将带有该符号的目标文件包含到您的库中.

Usually the symbol is defined in another library which also needs to be linked in to your application. Alternatively the symbol is undefined because you've forgotten to build the code that defines the symbol or you've forgotten to include the object file with that symbol into your library.

在您的情况下,它看起来像是您实现的 C 库中的一个符号,因此您希望它在您自己的库中未定义.它将在您的 libc.so 中定义,可能是/usr/lib.

In your case it looks like a symbol from your implementation's C library so you would expect that to be undefined in your own library. It will be defined in your libc.so wherever that is, possibly /usr/lib.

这篇关于nm:“U";符号未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆