linux -/usr/bin/ld : client: hidden symbol `__dso_handle'

标签 linux g++ shared-libraries ld

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

我使用的命令: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

我该如何解决这个错误?

最佳答案

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

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

nm ./libprint.so | grep __dso_handle

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

关于linux -/usr/bin/ld : client: hidden symbol `__dso_handle' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17389479/

相关文章:

android - 制作 Android 内核 - 模块准备

linux - maven调用在哪里?

c++ - 如何将 C++ 共享库与 gcc 链接

android - 在 Android Studio 中使用预构建库和 jni

为 openvz VM 编译内核模块?

linux - 为什么tomcat在初始化VM的时候一再报错

c++ - 通过 C++ 获取 micro SD 卡的大小

c - 在 C++ 模式下将 'c' 输入视为 'c++'

c++ - gcc 优化错误或 C++ 规则被破坏?

postgresql - MADlib apt 安装,如何安装?