Skip site navigation (1) Skip section navigation (2)

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
Subject: Re: Linking against static libpq using Visual C++
Date: 2011-02-27 22:34:20
Message-ID: 4D6AD16C.7050206@arcor.de (view raw or flat)
Thread:
Lists: pgsql-general
Okay, I could fix it by myself now:
One has to tell Visual C++ to ignore msvcrt.lib.
A warning message during the compilation of my code already lamented a 
conflict between msvcrt and the included libraries.
I should have taken it for serious instead of just ignoring it.
So now everything works fine and I know again why I usually prefer to 
work with GNU tools and linux whenever possible.
Thanks for your help.

> 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

pgsql-general by date

Next:From: Jasmin DizdarevicDate: 2011-02-27 23:13:32
Subject: Re: PG on two nodes with shared disk ocfs2 & drbd
Previous:From: Julia JacobsonDate: 2011-02-27 22:17:17
Subject: Re: Linking against static libpq using Visual C++

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group