小编evi*_*nje的帖子

未定义的'dlsym'参考

我看过很多类似的帖子,但是在书中尝试了每一个技巧,我仍在苦苦挣扎.一切都工作正常,但在安装/删除wireshark与一些组件/解析器后,它们都搞砸了.我不记得确切地卸载了哪些库/软件包,但可能比我注意到的要多得多.

如果我像这样创建一个简单的main.cpp文件:

#include <SQLAPI.h>
int main()
{
  SAConnection con;
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

并尝试

g ++ main.cpp -lsqlapi -ldl

它给我以下错误消息:

/usr/local/lib/libsqlapi.so: undefined reference to `dlsym'
/usr/local/lib/libsqlapi.so: undefined reference to `dlerror'
/usr/local/lib/libsqlapi.so: undefined reference to `dlopen'
/usr/local/lib/libsqlapi.so: undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我试图在-lsqlapi之前放-ldl,因为有些人认为订单很重要.如果我使用gcc而不是g ++,错误是:

/usr/bin/ld: /tmp/ccwBI4tj.o: undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

如果删除了SAConnection,我可以编译并运行该文件.

我不认为它与SQLAPI有任何关系,因为我遇到了与libboost类似的问题.我没有一个小代码示例,但是当我编译上周成功编译的项目时,我得到错误:

/usr/bin/ld: debug/components/helloworld/HelloWorld.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv' …
Run Code Online (Sandbox Code Playgroud)

c++ gcc compiler-errors ubuntu-13.10

20
推荐指数
1
解决办法
4万
查看次数

标签 统计

c++ ×1

compiler-errors ×1

gcc ×1

ubuntu-13.10 ×1