libpqxx-win32 r32368

Created 20th July, 2008 10:36 (UTC), last edited 20th July, 2008 11:09 (UTC)

Jeroen and I spent all day yesterday hanging around Soi Ari being far too geeky for our own good. As well as discussing libpqxx in some depth he showed me some ssh tricks and I showed him some Haskell and the conversations ranged far and wide over a all sorts of other topics too. In all we spent nearly ten hours poring over my laptop.

On the libpqxx we rethought how to handle all of the test programs and talked about how the build process for Windows should work in an ideal world. This release doesn't incorporate all of those changes, but it does include Jeroen's latest trunk for the upcoming 3 release and far fewer warnings (debug is down to 3 and release builds 1 even at warning level 4 with 64 bit warnings turned on).

This version can be downloaded from

Building and using libpqxx

The release should also be a little easier to use. Within the win32 area you will find an msvc8 folder which contains a couple of projects and a solution file. The simplest way to get libraries to use is to open the solution and simply build it. It assumes that Postgres was installed with headers and that Postgres was installed to the usual location.

After the build there will be a new install folder which contains the DLLs and library files. There are separate libraries for release and debug. The header files you will find in the pqxx folder under the libpqxx project.

The other way to use this is to copy the libpqxx project directory to the area where you have your other project files or reference it from your solution to include it in your normal build. This is probably particularly useful for those who need to change the build settings. Depending on how you need to do this you can even include all of the files in src into an existing project. A quick check list of things to do is:

  1. Make sure that the project includes has the Postgres include folder in its include path and itself in the path too.
  2. A pre-build event needs to execute cmd.exe /c build-headers.cmd "$(SolutionDir)" (the build-headers.cmd file is in the libpqxx project directory) in order to create the correct header structure.
  3. The following defines need to be set: PQXX_SHARED, PQXX_INTERNAL, _CRT_SECURE_NO_WARNINGS
  4. You will probably need to add libpqddll.lib (debug) and libpqdll.lib (release) to the “ignore specific library” option and the linker will need to add the libraries libpq.lib and wsock32.lib.
  5. If you copy the existing libpqxx project for use in your solutions you'll want to make sure that the output directories make sense.

Projects making use of libpqxx need the following:

  1. The libpqxx project directory on their path in order to see the pqxx header folder.
  2. You'll probably find that you need to add libpqddll.lib (debug) and libpqdll.lib (release) to the “ignore specific library” option.

To do

  1. Get the rest of the tests to execute.
  2. Create an installer that includes redistributable versions of the binary dependencies.

Categories: libpqxx-win32