在VS 2012项目中使用libpq (PostgreSQL)库

Using libpq (PostgreSQL) library in VS 2012 project

本文关键字:libpq PostgreSQL VS 2012 项目      更新时间:2023-10-16

我使用的是Windows 7 x64的VS 2012。我的朋友为我写了一个c++类,使用libpq:

...
#include <libpq-fe.h>
const char* QStrToCStr(QString qstring);
void ShowInfoBox(QString string);
QString IToQS(int x);
QString DToQS(double x);
class BinderHandler
{
private:
    PGresult* DBResultPointer;
    PGconn* DBConnPointer;
...
}
void BinderHandler::DBConnect()
{
    DBConnPointer = PQsetdbLogin(this->pghost,this->pgport,
                                 this->pgoptions,this->pgtty,
                                 this->dbName,this->login,this->pwd);
}
...

每次当我尝试构建项目时,我都会得到LNK2019错误。我已经安装了postgres,我加载了一些路径到项目属性我希望你能给我一个快速的指导,如何使他的代码工作,我的项目。

您必须显式指定额外的库libpq。