[英]Symbols not found during linking
I have a problem with a shared library (Linux) and a program that links against this library but does not find the symbols - although they are there. 我对共享库(Linux)和链接到该库的程序有问题,但是找不到符号-尽管它们在那里。 That's what I have: 那就是我所拥有的:
A shared library "libetest.so" that is located in /usr/lib. 位于/ usr / lib中的共享库“ libetest.so”。 When I do an 当我做一个
readelf -Ws /usr/lib/libetest.so.0
it gives (beside some others) this output: 它提供了(除了其他一些)此输出:
54: 000052c0 905 FUNC LOCAL DEFAULT 11 ETEST_open_connection
Now I have an application that makes use of ETEST_open_connection(). 现在,我有一个使用ETEST_open_connection()的应用程序。 When I build it with 当我用
gcc lib_test.cpp -DENV_LINUX -letest
it fails with a linker error 它失败,并显示链接器错误
lib_test.cpp:(.text+0x32): undefined reference to `ETEST_open_connection'
As shown before the symbol is there! 如前所述,符号在那里! Any idea why this fails? 知道为什么失败了吗?
Please try: 请试试:
gcc -DENV_LINUX -letest lib_test.cpp
This should be the correct argument order. 这应该是正确的参数顺序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.