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

余生颓废 提交于 2019-12-01 03:04:20

问题


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

command I used: g++ -o client Client.cpp -L. -lprint

Following is the error:

/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?


回答1:


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

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

nm ./libprint.so | grep __dso_handle

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).



来源:https://stackoverflow.com/questions/17389479/usr-bin-ld-client-hidden-symbol-dso-handle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!