Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 08-01-2012, 11:45 AM   #1
adept
 
Join Date: Mar 2007
Posts: 720
trying to use pqlib for postgresql connection

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.
pasita is offline   Reply With Quote
Old 08-01-2012, 06:21 PM   #2
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,133
Re: trying to use pqlib for postgresql connection

no idea but also just read this post: http://forumserver.twoplustwo.com/sh...66&postcount=6 which makes it sounds like VS needs paths added in several places. maybe that's it?
_dave_ is offline   Reply With Quote
Old 08-02-2012, 07:11 AM   #3
adept
 
Join Date: Mar 2007
Posts: 720
Re: trying to use pqlib for postgresql connection

Made it... I was using the lib file from my 64-bit installation of postgres while trying to build a 32 bit application. Got the 32-bit library and things work now.
pasita is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 11:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive