'libpq.lib' linking problem with VC++

From: Roy's Email <rmw256(at)hotmail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: 'libpq.lib' linking problem with VC++
Date: 2011-07-08 18:24:06
Message-ID: BAY161-w215F489413FC22F701E21F96400@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


My apologies if this is not the appropriate list for this, but the "novice" list has provided no response for weeks.

I'm using Visual Studios C++ Express 2008 on Windows 7 with the "standard" (pre-packaged) 64-bit Windows distribution of PostgreSQL v.9.0.4 and I am having unresolved refs when linking to libpq.lib. The relevant elements of my program are:

#include "stdafx.h"
#include "libpq-fe.h"
using namespace System;

int main(array<System::String ^> ^args)
{
...
char *pghost = "localhost",
*pgport = "5432",
*pgoptions = NULL,
*pgtty = NULL;
char *dbName = "mydb";
PGconn *conn;
/* make a connection to the database */
conn = PQsetdbLogin(pghost, pgport, pgoptions, pgtty, dbName, NULL, NULL);
...
)

Linking against libpq.lib in the postgres "lib" directory, the error I get is:

DBTest.obj : error LNK2001: unresolved external symbol "extern "C" struct pg_conn * __cdecl PQsetdbLogin( ...

In the project properties I have included the path to the postgres "lib" directory and listed "libpq.lib" as a linker input.

So, what am I missing? How do Iget this thing to link without error?

Regards,

- Roy

=*=*=
Always do right.
This will gratify some people and astonish the rest. - Mark Twain

The truth is rarely pure, and never simple. - Oscar Wilde

Browse pgsql-general by date

  From Date Subject
Next Message Darren Duncan 2011-07-08 19:34:08 Re: [HACKERS] Creating temp tables inside read only transactions
Previous Message Jeff Davis 2011-07-08 16:15:21 Re: [HACKERS] Creating temp tables inside read only transactions