简体   繁体   English

libpq:我应该使用哪些lib文件

[英]libpq: which lib files should I use

I used the PostgreSQL as my data base and I am coding a c++ project, so I have to use the libpq to connect it. 我使用PostgreSQL作为数据库,并且正在编写c ++项目,因此必须使用libpq进行连接。

I have already found the include file and lib file in the PostgreSQL file but there are too many files. 我已经在PostgreSQL文件中找到了include文件和lib文件,但是文件太多。 I think I don't need to add them all. 我想我不需要全部添加它们。
For the include file, I just added libpq-fe.h , pg_config_ext.h and postgres_ext.h , then I included the libpq-fe.h , it seems that everything goes well, I can call some functions such as PQconnectdb , PQexec etc. But when I compile it, I get some LNK errors, meaning that I didn't add the right lib files. 对于包含文件,我只添加了libpq-fe.hpg_config_ext.hpostgres_ext.h ,然后包含了libpq-fe.h ,看来一切正常,我可以调用一些函数,例如PQconnectdbPQexec等但是,当我编译它时,出现了一些LNK错误,这意味着我没有添加正确的lib文件。
I've tried to add libpq.lib and libpq.dll , but I still got the LNK errors. 我试图添加libpq.liblibpq.dll ,但是我仍然遇到LNK错误。
Does someone know which lib files should I add? 有人知道我应该添加哪些lib文件吗?

I got this error because of the wrong version. 由于版本错误,导致出现此错误。
Here is a same problem which has been solved. 是已经解决的相同问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM