c++ - Visual Studio C++ : Getting Unresolved tokens and unresolved link. 我该怎么办?

标签 c++ visual-studio sqlite visual-c++ visual-studio-2013

我想使用 SQLite,但出现 Unresolved -* 错误。以下是我所做工作的总结:

这是三个目录:

源文件

-->include
-->src
-->sqlite3

我已将以上三个目录全部添加到:

Project Properties->C/C++->Additional Include Directories

然后在我的 main.cpp 文件中,我添加了以下行:

#include<SQLite/SQliteCpp.h> // this inclusion is correct

但是我得到如下错误:

error LNK2028: unresolved token (0A0003DF) "public: virtual __thiscall SQLite::Column::~Column(void)" (??1Column@SQLite@@$$FUAE@XZ) referenced in function "public: virtual void * __thiscall SQLite::Column::`vector deleting destructor'(unsigned int)" (??_EColumn@SQLite@@$$FUAEPAXI@Z)
error LNK2028: unresolved token (0A0003EE) "public: __thiscall SQLite::Statement::Ptr::Ptr(class SQLite::Statement::Ptr const &)" (??0Ptr@Statement@SQLite@@$$FQAE@ABV012@@Z) referenced in function "public: __thiscall SQLite::Column::Column(class SQLite::Column const &)" (??0Column@SQLite@@$$FQAE@ABV01@@Z)
error LNK2028: unresolved token (0A0003EF) "public: __thiscall SQLite::Statement::Ptr::~Ptr(void)" (??1Ptr@Statement@SQLite@@$$FQAE@XZ) referenced in function "public: __thiscall SQLite::Column::Column(class SQLite::Column const &)" (??0Column@SQLite@@$$FQAE@ABV01@@Z)
error LNK2019: unresolved external symbol "public: __thiscall SQLite::Statement::Ptr::Ptr(class SQLite::Statement::Ptr const &)" (??0Ptr@Statement@SQLite@@$$FQAE@ABV012@@Z) referenced in function "public: __thiscall SQLite::Column::Column(class SQLite::Column const &)" (??0Column@SQLite@@$$FQAE@ABV01@@Z)
error LNK2019: unresolved external symbol "public: __thiscall SQLite::Statement::Ptr::~Ptr(void)" (??1Ptr@Statement@SQLite@@$$FQAE@XZ) referenced in function "public: __thiscall SQLite::Column::Column(class SQLite::Column const &)" (??0Column@SQLite@@$$FQAE@ABV01@@Z)

最佳答案

假设您使用的是标准的 sqlite 源代码分发版,应该有一个 .c 或 .cpp 文件 在你的 sqlite3 目录中。该文件需要包含在项目中并与您的源代码一起编译。另一种可能性是您可能已经收到带有 .lib 文件的 sqlite3 header ——如果是这种情况,那么您需要将库与您的项目链接起来。

您收到这些错误的原因是因为您的头文件 (sqlite3.h) 正在引用函数/符号/等。没有定义。因此,这就是为什么您需要将 .c/.cpp 文件与您的项目一起包含(以便您提供定义),或者链接到基本上执行相同操作的预编译 .lib。

关于c++ - Visual Studio C++ : Getting Unresolved tokens and unresolved link. 我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27088588/

相关文章:

c++ - Opencv cv::垫公差区间

c++ - 由于某些原因,for循环中的数组不起作用

cli 上的 sqlite3 磁盘 I/O 错误

单击按钮插入/查询 SQLite 数据库时,Android Studio 应用程序崩溃

Spring+Hibernate+SQLite 事务异常

c++ - 使用自定义服务器通过 http 安全传输数据

c++ - C++ 中的 char 数组和指向 char 的指针

visual-studio - 如何将调试器附加到 Visual Studio 2017 中的 Azure Web 应用?

C没有bool?还有VS2010的问题

c# - HTTP 403.14错误(Web服务器配置为不列出该目录的内容)