【发布时间】:2020-02-11 17:29:23
【问题描述】:
我正在尝试建立与 MySQL 数据库的连接。代码编译得很好,但是在链接时我总是会出错。我已经尝试过动态和静态链接,但没有任何效果。一些错误:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall mysqlx::abi2::r0::Error::Error(char const *)" (__imp_??0Error@r0@abi2@mysqlx@@QAE@PBD@Z) referenced in function "protected: void __thiscall mysqlx::abi2::r0::Value::check_type(enum mysqlx::abi2::r0::Value::Type)const " (?check_type@Value@r0@abi2@mysqlx@@IBEXW4Type@1234@@Z) DatabaseTest
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall mysqlx::abi2::r0::DbDoc::~DbDoc(void)" (__imp_??1DbDoc@r0@abi2@mysqlx@@QAE@XZ) referenced in function "public: __thiscall mysqlx::abi2::r0::Value::~Value(void)" (??1Value@r0@abi2@mysqlx@@QAE@XZ) DatabaseTest
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall mysqlx::abi2::r0::DbDoc::DbDoc(void)" (__imp_??0DbDoc@r0@abi2@mysqlx@@QAE@XZ) referenced in function "public: __thiscall mysqlx::abi2::r0::Value::Value(void)" (??0Value@r0@abi2@mysqlx@@QAE@XZ) DatabaseTest
#include <iostream>
#include "mysqlx/xdevapi.h"
int main()
{
//short test, program doesn't compile, the headers aren't included here because they are more than 1000 lines long. You can get them at the MySQL homepage
return 0;
}
我使用最新版本的连接器。如果您想检查设置,可以下载项目here。有人有想法吗?
【问题讨论】:
-
欢迎来到 Stack Overflow!请在您的问题帖子作为文本中包含所有相关代码。最好是minimal, reproducible example。您提供的链接等链接可能会随着时间的推移而变得陈旧,您的问题对未来的观看者的用处将大大降低。
-
使用 MySQL 的 C 库。我在尝试编译 C++ 时遇到了太多麻烦。到目前为止,C 语言界面没有问题。
标签: c++ mysql mysql-connector mysqlconnection