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

查看:2169
本文介绍了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.

在你的case它看起来像一个符号从实现的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天全站免登陆