Trying to connect to my postgres db. Also trying to learn about using dlls.
Using Win7 64bit, MS Visual C++ 2010 Express and the precompiled .lib and .dll from my postgres (9.0) installation, I get a linking error
>test.obj : error LNK2001: unresolved external symbol _PQconnectdb referenced in function _wmain
>fatal error LNK1120: 1 unresolved externals
my _tmain reduced to minimum:
Code:
int _tmain(int argc, _TCHAR* argv[])
{
PGconn *conn;
conn = PQconnectdb("dbname=PT419 host=localhost user=postgres password=mypass");
}
I do have the libpq-fe.h and other relevant .h files in correct places as this compiles (but doesn't link). I also believe I've correctly added libpq.lib to the additional dependencies and it's found (if I intentionally misspell the libname I get linking error about the file not found).
Any help appreciated. To start with, I have no clue why the linker is looking for the function starting with underscore... in case it was left unclear, I might add that I'm not too familiar with Windows development.