free counters
Diberdayakan oleh Blogger.

Selasa, 29 Oktober 2013

Compiling PostgreSQL 9.2 Driver for Qt 5.1 on Windows XP (mingw32)

by Unknown  |  in Qt at  Selasa, Oktober 29, 2013

These are steps to compile PostgreSQL 9.2 for Qt 5.1 on Windows XP (with mingw32 compiler), here I assume we've install Qt 5.1 on directory "C:\Qt" and  PostgreSQL on "C:\Program Files\PostgreSQL":

1.open console Qt5.1 for Desktop from Qt 5.1 menu.
2.In the console, go to "C:\Qt\Qt5.1.0\5.1.0\Src\qtbase\src\plugins\sqldrivers\psql" by cd-ing,

cd C:\Qt\Qt5.1.0\5.1.0\Src\qtbase\src\plugins\sqldrivers\psql
3. create makefile with this command in console:
qmake "INCLUDEPATH+=\"C:\Program Files\PostgreSQL\9.2\include\"" "LIBS+=\"C:\Program Files\PostgreSQL\9.2\lib\libpq.lib\"" psql.pro
4. Find and change text in file "C:\Program Files\PostgreSQL\9.2\include\pthread.h"

 from
#ifndef _TIMESPEC_DEFINED
struct timespec {
        long tv_sec;
        long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
to
#ifndef HAVE_STRUCT_TIMESPEC
#define HAVE_STRUCT_TIMESPEC 1
#ifndef _TIMESPEC_DEFINED
struct timespec {
        long tv_sec;
        long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */
to solve this error
c:\qt\qt5.1.0\tools\mingw48_32\i686-w64-mingw32\include\sys\timeb.h:90:8: error:
 previous definition of 'struct timespec'
 struct timespec {

5. Do make in console by typing make then enter:
make
6. Now, you can get the compiled driver from directory "C:\Qt\Qt5.1.0\5.1.0\Src\qtbase\plugins\sqldrivers"



Have a nice programming time :D ;)

0 comments:

Silahkan tinggalkan komentar anda: