Re: Linking against static libpq using Visual C++

From: Julia Jacobson <julia(dot)jacobson(at)arcor(dot)de>
To: pgsql-general(at)postgresql(dot)org
Cc: Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Linking against static libpq using Visual C++
Date: 2011-02-27 22:17:17
Message-ID: 4D6ACD6D.6060503@arcor.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

My application looks like this:

#include <iostream>
#include "libpq-fe.h"

using namespace std;

int main(void)
{
PGconn *conn;
const char *info = "hostaddr = 'postgres.server.com' \
port = '5432' \
dbname = 'mydb' \
user = 'user' \
password = 'secret' \
connect_timeout = '3'";
conn = PQconnectdb (info);
return 0;
}

Unfortunately, I really can't figure out the problem with it.
However, the code works fine when I try to compile it using:
g++ -I"C:\Programs\PostgreSQL8.4\include" \
-L"C:\Programs\PostgreSQL\8.4\lib" \
-lpq \
main.cpp

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julia Jacobson 2011-02-27 22:34:20 Re: Linking against static libpq using Visual C++
Previous Message Jens Wilke 2011-02-27 21:35:28 Re: Hot Standby - ERROR: canceling statement due to conflict with recovery