PQescapeLiteral没有定义?

这是我能想到的最基本的libpq示例来说明我的问题。这里的目标是打印出转义字符串。
#include <iostream>
#include <libpq-fe.h>
#include <string.h>

using namespace std;

int main(){
    PGconn *db;
    char connstring[] = "dbname=TheInternet";
    db = PQconnectdb(connstring);
    char url[] = "http://www.goo'gle.com/";
    cout<<PQescapeLiteral(db, (const char *)url, (size_t) strlen(url))<<"n";
}
当我编译时:
g++ PQescapeLiteral_test.cpp -lpq 
甚至是:
g++ PQescapeLiteral.cpp -I/usr/include/pgsql:/usr/include/pgsql/server:/usr/include/pgsql/server/libpq -lpq
我收到错误:
PQescapeLiteral.cpp: In function ‘int main()’:
PQescapeLiteral.cpp:12: error: ‘PQescapeLiteral’ was not declared in this scope
我在第31.3.4节的pgsql 9.0手册中找到了PQescapeLiteral:在SQL命令中包含了包含的字符串。我从yum获得了最新版本的libpq和libpq-devel,所以我很确定它应该被定义。 如果有人能指出我正确的方向,我会很感激。     
已邀请:
它适用于我,使用PostgreSQL 9.0.1标头。您使用的是哪个版本的postgresql标头和库? PQescapeLiteral显然是在9.0中添加的:http://developer.postgresql.org/pgdocs/postgres/release-9-0.html#AEN104548 你期待libpq.so在哪里?使用-I开关显示编译器命令,以在非标准位置定位头文件,但没有相应的-L开关来定位库。     

要回复问题请先登录注册