compile libpq prog with mingw32 - Mailing list pgsql-general

From Matthew Nuzum
Subject compile libpq prog with mingw32
Date
Msg-id 001601c2caf8$14d8ae00$6900a8c0@mattspc
Whole thread Raw
List 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@bearfruit.org




pgsql-general by date:

Previous
From: Mitch
Date:
Subject: Re: FreeBSD: SMP and PostgreSQL
Next
From: rusland@scn.ru (Ruslan A Dautkhanov)
Date:
Subject: FreeBSD: SMP and PostgreSQL