Windows Postgresql and Dev-Cpp/Dev-C++/MINGW configuration example

From: Reid Thompson <reid(dot)thompson(at)ateb(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Windows Postgresql and Dev-Cpp/Dev-C++/MINGW configuration example
Date: 2005-10-04 03:49:10
Message-ID: 4341FBB6.1000803@ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I thought it might be of interest to some to post steps to using
PostgreSQL on
Windows with the Dev-Cpp/MINGW IDE/compiler.This example is C, but the
steps for configuring the IDE/Project to use the PostgreSQL libs/headers
should be the same or very similar for C++/ecpg.

Install PostgreSQL for Windows using the windows installer(for those
who haven't used the PostgreSQL windows installer, it's a quick and
easy process).

Start Dev-C++.
Select File->New->Project.
Select Console Application.
Select C project.
Give the project a pertinent name(myPgsqlTest).
Click OK.
Create a new dir to contain the Project(give it a pertinent name).
Save the initial project.
Select Project->Project Options.
Select the Parameters Tab.
Click the Add Library or Object button.
Traverse to your PostgreSQL installation 's lib directory - mine is
../../../PostgreSQL/8.0/lib/ and select libpq.a.
In my case, the linker window now contains
../../../PostgreSQL/8.0/lib/libpq.a.
Select the Directories Tab.
Select the Include Directories sub-tab.
Traverse to and select your PostgreSQL installation' s include
directory -
mine is D:\PostgreSQL\8.0\include.
Click on Add(your Include directories window should now list this
path).
Click on OK to close the Project Options Dialog
Insure that the db 'test' exists in your PostgreSQL instance, or change
'test'
in the conninfo to your test db when you populate the other appropriate
values
for your connection.
Replace the Dev-C++ template created main.c

#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{

system("PAUSE");
return 0;
}

with the attached file
(created using the libpq example from www.postgresql.org/docs)

reid

Attachment Content-Type Size
pgsql_devcpp.c text/x-c 6.6 KB

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2005-10-04 04:58:54 Re: Connecting form Access or VB6 to PostgreSQL 8
Previous Message Sebastian Iglesias 2005-10-04 02:33:58 SQLService on Win XP