/usr/bin/ld: 客户端:隐藏符号 `__dso_handle' [英] /usr/bin/ld: client: hidden symbol `__dso_handle'

查看:24
本文介绍了/usr/bin/ld: 客户端:隐藏符号 `__dso_handle'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与我的 C++ 程序中的共享库链接.

I am trying to link with a shared lib in my C++ program.

我使用的命令:g++ -o client Client.cpp -L.-lprint

以下是错误:

/usr/bin/ld: client: hidden symbol `__dso_handle' in /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status

我该如何解决这个错误?

How can I resolve this error?

推荐答案

/usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o 中的隐藏符号 `__dso_handle' 被 DSO 引用

hidden symbol `__dso_handle' in /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o is referenced by DSO

大概 libprint.so 就是引用 DSO.您可以通过以下方式确认:

Presumably libprint.so is that referencing DSO. You can confirm with:

nm ./libprint.so | grep __dso_handle

如果产生 U __dso_handle 输出,则您的 libprint.so 构建不正确(很可能您使用 ld -shared 链接它. 不要那样做,使用编译器驱动,例如 g++ -shared ... 代替).

If that produces a U __dso_handle output, your libprint.so was built incorrectly (most likely you used ld -shared to link it. Don't do that, use the compiler driver, e.g. g++ -shared ... instead).

这篇关于/usr/bin/ld: 客户端:隐藏符号 `__dso_handle'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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