Monday, January 19, 2009

Include Directories and Library for Developing PostGIS C Programs

To start developing PostgreSQL and PostGIS C/C++ programs in Microsoft Visual Studio 6.0, there are a couple of Include file directories which you should set as part of the configuration of the development environment. The directories are the following:
(a) c:\PROGRAM FILES\POSTGRESQL\8.x\INCLUDE\
(b) c:\PROGRAM FILES\POSTGRESQL\8.x\INCLUDE\LIBPQ\

These can be set in the Options dialog box which can be opened by selecting Tools > Options in Microsoft Visual Studio 6.0, as shown below.



Besides the include files setting, another useful directory to define is the Library files directories. Only one library directory - C:\PROGRAM FILES\POSTGRESQL\8.x\LIB\ need to be set in the Options dialog box, as shown in the figure below.



The PostgreSQL/PostGIS executable you are developing can be statically linked with the PostgreSQL library libpq.lib. Or if you prefer, you can link the executable to the dynamic link library libpq.dll. Select Project > Settings to open the Project Settings dialog box and type in the library to link to under the Link tab, as shown in the figure below.

No comments: