error LNK2019: unresolved external symbo UnQLite

五迷三道 提交于 2019-12-11 13:43:40

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/31039015/error-lnk2019-unresolved-external-symbo-unqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!