PDA

View Full Version : [Qt 5.2.1] Building sql DB2 driver error



Hypnotic92
29th June 2014, 20:30
I want to build a sql driver for IBM DB2 so i can use it in my program.
I am following this guide http://qt-project.org/doc/qt-4.8/sql-driver.html.

I have installed DB2 Express-C for Windows 64-bit.
I downloaded the qt-everywhere-opensource-src-5.2.1 source code.
I succesfully executed qmake “INCLUDEPATH+=C:\PROGRA~1\IBM\sqllib\include ” “LIBS+=C:\PROGRA~1\IBM\sqllib\lib\db2cli.lib ” in this folder qtbase\src\plugins\sqldrivers\db2.
After that i ran mingw32-make and it fails with this message:

C:\Qt\5.2.1\Src\qtbase\src\plugins\sqldrivers\db2>mingw32-make
mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory 'C:/Qt/5.2.1/Src/qtbase/src/plugins/sqldrive
rs/db2'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
all -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCE
PTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I'C:/PROGRA~1/I
BM/sqllib/include' -I'C:/Qt/5.2.1/mingw48_32/include/QtSql/5.2.1' -I'C:/Qt/5.2.1
/mingw48_32/include/QtSql/5.2.1/QtSql' -I'C:/Qt/5.2.1/mingw48_32/include' -I'C:/
Qt/5.2.1/mingw48_32/include/QtSql' -I'C:/Qt/5.2.1/mingw48_32/include/QtCore/5.2.
1' -I'C:/Qt/5.2.1/mingw48_32/include/QtCore/5.2.1/QtCore' -I'C:/Qt/5.2.1/mingw48
_32/include/QtCore' -I'.moc/release' -I'C:/PROGRA~1/IBM/SQLLIB/INCLUDE' -I'C:/PR
OGRA~1/IBM/SQLLIB/LIB' -I'C:/Python27/include' -I'C:/Python27' -I'../../../../mk
specs/win32-g++' -o .obj/release/qsql_db2.o ../../../sql/drivers/db2/qsql_db2.cp
p
../../../sql/drivers/db2/qsql_db2.cpp:63:0: warning: "UNICODE" redefined [enable
d by default]
#define UNICODE
^
<command-line>:0:0: note: this is the location of the previous definition
In file included from C:/PROGRA~1/IBM/sqllib/include/sqlcli.h:983:0,
from C:/PROGRA~1/IBM/sqllib/include/sqlcli1.h:45,
from ../../../sql/drivers/db2/qsql_db2.cpp:65:
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1747:5: error: '__in_ecount' has not bee
n declared
__in_ecount(cchConnStrIn)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1748:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szConnStrIn,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1864:5: error: '__in_ecount' has not bee
n declared
__in_ecount(cchConnStrIn)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1865:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szConnStrIn,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1890:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1891:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1906:5: error: '__out_opt' has not been
declared
__out_opt
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1907:23: error: expected ',' or '...' be
fore '*' token
SQLSMALLINT *pfSqlType,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1919:5: error: '__out_opt' has not been
declared
__out_opt
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1920:23: error: expected ',' or '...' be
fore '*' token
SQLULEN *pcrow,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1926:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchPkCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1927:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szPkCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1951:5: error: '__in_ecount' has not bee
n declared
__in_ecount(cchSqlStrIn) SQLCHAR* szSqlStrIn,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1951:30: error: expected ',' or '...' be
fore 'SQLCHAR'
__in_ecount(cchSqlStrIn) SQLCHAR* szSqlStrIn,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1960:5: error: '__out_opt' has not been
declared
__out_opt
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1961:23: error: expected ',' or '...' be
fore '*' token
SQLSMALLINT *pcpar);
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1970:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1971:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1982:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1983:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1997:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1998:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2017:5: error: '__in_ecount_opt' has not
been declared
__in_ecount_opt(cchCatalogName)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2018:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szCatalogName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2030:5: error: '__out_ecount_opt' has no
t been declared
__out_ecount_opt(cchDriverDescMax)
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2031:5: error: expected ',' or '...' bef
ore 'SQLCHAR'
SQLCHAR *szDriverDesc,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2086:5: error: '__out' has not been decl
ared
__out
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2087:20: error: expected ',' or '...' be
fore '*' token
SQLHANDLE *phOutput);
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2127:5: warning: '__stdcall__' attribute
only applies to function types [-Wattributes]
__in_opt LPWSTR szFileName,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2127:5: error: '__in_opt' was not declar
ed in this scope
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2128:22: error: 'cbOutputMsg' was not de
clared in this scope
__out_bcount_opt(cbOutputMsg) LPWSTR lpwszOutputMsg,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2128:33: error: '__out_bcount_opt' was n
ot declared in this scope
__out_bcount_opt(cbOutputMsg) LPWSTR lpwszOutputMsg,
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2129:5: error: '__in' was not declared i
n this scope
__in DWORD cbOutputMsg
^
C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2130:1: error: expression list treated a
s compound expression in initializer [-fpermissive]
);
^
../../../sql/drivers/db2/qsql_db2.cpp: In member function 'virtual bool QDB2Driv
er::hasFeature(QSqlDriver::DriverFeature) const':
../../../sql/drivers/db2/qsql_db2.cpp:1510:12: warning: enumeration value 'Cance
lQuery' not handled in switch [-Wswitch]
switch (f) {
^
Makefile.Release:500: recipe for target '.obj/release/qsql_db2.o' failed
mingw32-make[1]: *** [.obj/release/qsql_db2.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/5.2.1/Src/qtbase/src/plugins/sqldriver
s/db2'
makefile:38: recipe for target 'release-all' failed
mingw32-make: *** [release-all] Error 2

By the way, i am using mingw32 on Windows 7 ×64.
I hope someone helps me, i really cant figure this on my own.

andrewchen
27th December 2014, 10:25
hi Hypnotic92,
have u figured out the problem? actually i encounter the same problem.