0

因此,在使用 GCC 的 Ubuntu 12.04 LTS x64 下使用 mysql++ 编译程序时出现此错误。详细其:

/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function add_plugin:
(.text+0x253): undefined reference to dlclose
/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function mysql_client_plugin_deinit:
(.text+0x2c7): undefined reference to dlclose
/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function mysql_load_plugin_v:
(.text+0x524): undefined reference to dlopen
/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function mysql_load_plugin_v:
(.text+0x54a): undefined reference to dlsym
/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function mysql_load_plugin_v:
(.text+0x67f): undefined reference to dlerror
/usr/lib/i386-linux-gnu/libmysqlclient.a(client_plugin.c.o): In function mysql_load_plugin_v:
(.text+0x695): undefined reference to dlclose

我已经安装了:libmysql++-3、libmysqlclient18 和 libmysqlclient18-dev、libdml3 和 libdml3-dev 库按以下顺序链接:

/usr/lib/libmysqlpp.a
/usr/lib/i386-linux-gnu/libdl.a
/usr/lib/i386-linux-gnu/libmysqlclient.a

作为链接器包含目录,我有:

/usr/lib
/usr/lib/i386-linux-gnu
4

1 回答 1

2

将评论变成答案。以免丢失:

您必须-ldl仅在-lmysqlclient. 链接顺序很重要。

于 2013-09-18T17:31:34.343 回答