This page in other versions: 9.1 / 9.2 / 9.3 / 9.4 / current (9.5)  |  Development versions: devel  |  Unsupported versions: 9.0

16.2. Building libpq with Visual C++ or Borland C++

Using Visual C++ 7.1-9.0 or Borland C++ to build libpq is only recommended if you need a version with different debug/release flags, or if you need a static library to link into an application. For normal use the MinGW or Visual Studio or Windows SDK method is recommended.

To build the libpq client library using Visual Studio 7.1 or later, change into the src directory and type the command:

nmake /f win32.mak

To build a 64-bit version of the libpq client library using Visual Studio 8.0 or later, change into the src directory and type in the command:

nmake /f win32.mak CPU=AMD64

See the win32.mak file for further details about supported variables.

To build the libpq client library using Borland C++, change into the src directory and type the command:

make -N -DCFG=Release /f bcc32.mak

16.2.1. Generated Files

The following files will be built:


The dynamically linkable frontend library


Import library to link your programs to libpq.dll


Static version of the frontend library

Normally you do not need to install any of the client files. You should place the libpq.dll file in the same directory as your applications executable file. Do not install libpq.dll into your Windows, System or System32 directory unless absolutely necessary. If this file is installed using a setup program, then it should be installed with version checking using the VERSIONINFO resource included in the file, to ensure that a newer version of the library is not overwritten.

If you are planning to do development using libpq on this machine, you will have to add the src\include and src\interfaces\libpq subdirectories of the source tree to the include path in your compiler's settings.

To use the library, you must add the libpqdll.lib file to your project. (In Visual C++, just right-click on the project and choose to add it.)

Add Comment

Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.

Proceed to the comment form.

Privacy Policy | About PostgreSQL
Copyright © 1996-2016 The PostgreSQL Global Development Group