Обсуждение: Linking libpq.lib with VC++
I can not be the first person to have this problem but can't find any definitive info that seems to address this.
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 = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
...
)
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( ...
So, how do I fix this?
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
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 = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
...
)
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( ...
So, how do I fix this?
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