Re: Windows 7 64 bit, Postgres 9 64 bit, MS C++ Express Linker error

From: Roy's Email <rmw256(at)hotmail(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Cc: <shy_guy_001(at)hotmail(dot)com>
Subject: Re: Windows 7 64 bit, Postgres 9 64 bit, MS C++ Express Linker error
Date: 2011-11-12 21:11:59
Message-ID: BAY161-W5C946EFD51F69BCA5DED296C20@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


>Roy, did you fix your problem?
After a fashion, but I regret that it was so long ago that I don't remember exactly what I did. What I _think_ I did, was get the source and rebuild the libraries; in particular, the 'pq' libraries/dll's. I then used the "release" version of postgres but compiled my program using the 'pq' dll's I had rebuilt. I'm sorry I can't be more definite about this, but it's been a while since I got things working and the project has been on hold for for the last few months. If there's some way I can be of more help, let me know, but, as I said, my memory is pretty rusty. This was on Win7/64-bit using Visual C++ 2008 Express. I used postgres 9.0 (9.0.4) [downloaded the 64-bit "packaged" win64 release and used the sources corresponding to that same version].
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

From: shy_guy_001(at)hotmail(dot)com
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] Windows 7 64 bit, Postgres 9 64 bit, MS C++ Express Linker error
Date: Sat, 12 Nov 2011 02:19:43 +0000

Hi,
Im having link problems and need help.
I have: Windows 7 64 bit installed postgresql-9.0.5-1-windows-x62.exe installed Visual c++ 2008 Express Edition set c/c++->additional Include Directories (seems to be ok as it compiles if I remove the PGconn and conn lines from the program and only have the libpq-fe.h header. set Linker->General->Additional Library Directories set Linker->Input->Additional Dependencies (libpq.lib)
Previous on a different older laptop: Windows XP Postgress 8.4 and 9.1 installed Visual c++ 2008 Express Edition Same program and settings and it compiled ok against 8.4 and 9.1 Also had Eclipse with MinGW and it compiled ok against 8.4 and 9.1
So I dont know what I'm doing wrong ... and Im sure its something stupid buts its driving me crazy.I saw a similar post by "Roy's Email" but there were no responses. :(Roy, did you fix your problem?
Thanks,Kim==================================================================================#include "stdafx.h"#include <iostream>#include <libpq-fe.h>
int _tmain(int argc, _TCHAR* argv[]){ PGconn *conn = NULL;
conn = PQconnectdb("user=postgres password=test123 dbname=testdb hostaddr=127.0.0.1 port=5432");
return 0;}
1>Linking...1>postgres_connection_test.obj : error LNK2019: unresolved external symbol _PQconnectdb referenced in function _wmain1>C:\Users\kim\Documents\Visual Studio 2008\Projects\postgres_connection_test\Debug\postgres_connection_test.exe : fatal error LNK1120: 1 unresolved externals1>Build log was saved at "file://c:\Users\kim\Documents\Visual Studio 2008\Projects\postgres_connection_test\postgres_connection_test\Debug\BuildLog.htm"1>postgres_connection_test - 2 error(s), 0 warning(s)

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message royecohen 2011-11-14 15:57:04 Re: CSVLOG fields
Previous Message shy guy 2011-11-12 02:19:43 Windows 7 64 bit, Postgres 9 64 bit, MS C++ Express Linker error