compile libpq prog with mingw32

From: "Matthew Nuzum" <cobalt(at)bearfruit(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: compile libpq prog with mingw32
Date: 2003-02-02 20:20:27
Message-ID: 001a01c2caf8$86434190$6900a8c0@mattspc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry in advance for such a lame question. I really don't work with
windows programming.

I've got a simple client program working on linux, but I need to compile
it on windows as well and I'd prefer to use the dev-cpp programming
environment with mingw to compile it. (because my other client libraries
I need give good examples using this environment)

I was wondering if anyone here has set up a similar environment and if
so, what they did.

I'm starting with Bruce's sample client program at
http://www.ca.postgresql.org/docs/aw_pgsql_book/node147.html as my test
case.

I've done a default install of dev-cpp (www.bloodshed.net) using the
dev-c++ 5.0 beta 7 and Mingw/gcc 2.95.3.

I've tried copying (from the 7.2.3 source tarball) src/include/* to
C:\dev-cpp\include and I changed the include in my c file to #include
"libpq/libpq-fe.h" which allows the program to compile but I get linker
errors like:
[Linker error] undefined reference to `PQconnectdb'
[Linker error] undefined reference to `PQstatus'
[Linker error] undefined reference to `PQerrorMessage'
[Linker error] undefined reference to `PQexec'
[Linker error] undefined reference to `PQresultStatus'
... and more.

I'm sorry to say that I'm used to this stuff all being in the right
place and just typing:
cc file.c -o file -lpg
and having it work.

Any help or suggestions greatly appreciated.

--
Matthew Nuzum
www.bearfruit.org
cobalt(at)bearfruit(dot)org

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2003-02-02 20:32:57 Re: basic access problem on W2K
Previous Message Matthew Nuzum 2003-02-02 20:17:16 compile libpq prog with mingw32