gpt4 book ai didi

c++ - SOCI 的问题

转载 作者:行者123 更新时间:2023-11-28 07:09:37 25 4
gpt4 key购买 nike

我正在尝试使用 SOCI 库来轻松访问 MySQL,但我无法安装该库。

到目前为止我所做的是:

  • 创建项目并使用 CMake 编译
  • 将我的项目链接到编译后创建的 lib/release 目录。
  • 将我的项目链接到 MySQL C 连接器 lib 目录

这是我的额外包含目录: http://puu.sh/6qGNP.png

但是不知何故,当我编译示例程序时,我得到了一堆像这样的链接器错误:

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall soci::details::standard_into_type::~standard_into_type(void)" (??1standard_into_type@details@soci@@UAE@XZ) referenced in function "public: virtual __thiscall soci::details::into_type::~into_type(void)" (??1?$into_type@H@details@soci@@UAE@XZ) 1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall soci::details::standard_into_type::post_fetch(bool,bool)" (?post_fetch@standard_into_type@details@soci@@MAEX_N0@Z)

我哪里搞砸了?

最佳答案

来自文档:

必需的客户端库

SOCI MySQL 后端需要 MySQL 的 libmysqlclient 客户端库。

请注意,SOCI 库本身也依赖于 libdl,因此编译基本客户端程序所需的最少库集是:

-lsoci_core -lsoci_mysql -ldl -lmysqlclient

这一直对我有用。如果您想从构建位置链接它们,则需要将带有库路径的 -L 开关传递给编译器。

关于c++ - SOCI 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21221170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com