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\psql3. 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.pro4. Find and change text in file "C:\Program Files\PostgreSQL\9.2\include\pthread.h"
from
#ifndef _TIMESPEC_DEFINEDto
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
#ifndef HAVE_STRUCT_TIMESPECto solve this error
#define HAVE_STRUCT_TIMESPEC 1
#ifndef _TIMESPEC_DEFINED
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */
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:
make6. 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: