本文介绍了错误LNK2019:未解析的外部符号UnQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Uncommite数据库与visual studio 2012,但当我尝试打开数据库时,我得到以下错误:



错误LNK2019:unresolved外部符号在函数bool __cdecl connect_database(void)(?connect_database @@ YA_NXZ)中引用的int __cdecl unqlite_open(struct unqlite * *,char const *,unsigned int)(?unqlite_open @@ YAHPAPAUunqlite @@ PBDI @ p>

这是我的代码:



void connect_database(){

  //打开我们的数据库; 
rc = unqlite_open(& pDb,myDB.db,UNQLITE_OPEN_CREATE);

if(rc!= UNQLITE_OK){return; }

}



帮助。



感谢。

解决方案

如果您正在编译项目在C ++中,并且在C ++文件中包含了unqlite.h头文件,你可能想用一个externC语句包围它。应如下所示:

  externC{
#includeunqlite.h
}

我相信项目根目录下的分布式头文件缺少这个语句。你也可以尝试使用Unqlite GitHub上的 scr / 文件夹下的unqlite.h文件,它有这样的语句:





干杯!


I am trying to use UnQLite database with visual studio 2012, but when I try to open the database I got the following error:

error LNK2019: unresolved external symbol "int __cdecl unqlite_open(struct unqlite * *,char const *,unsigned int)" (?unqlite_open@@YAHPAPAUunqlite@@PBDI@Z) referenced in function "bool __cdecl connect_database(void)" (?connect_database@@YA_NXZ)

This is my code:

void connect_database() {

 // Open our database;
 rc = unqlite_open(&pDb,"myDB.db",UNQLITE_OPEN_CREATE);

 if( rc != UNQLITE_OK ){ return; }

}

I would appreciate your help.

Thanks.

解决方案

If your are compiling your project in C++, and included the unqlite.h header in a C++ file, you might want to surround it with an extern "C" statement. This should look like this:

extern "C" {
#include "unqlite.h"
}

I believe that the distributed header file at the root of the project lacks this statement. You can alternatively try to use the unqlite.h file under the scr/ folder on the Unqlite GitHub, that does have this statement inside:

https://github.com/symisc/unqlite

Cheers!

这篇关于错误LNK2019:未解析的外部符号UnQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 23:30