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:
Qt Code:
  1. C:\Qt\5.2.1\Src\qtbase\src\plugins\sqldrivers\db2>mingw32-make
  2. mingw32-make -f Makefile.Release all
  3. mingw32-make[1]: Entering directory 'C:/Qt/5.2.1/Src/qtbase/src/plugins/sqldrive
  4. rs/db2'
  5. g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
  6. all -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCE
  7. PTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I'C:/PROGRA~1/I
  8. BM/sqllib/include' -I'C:/Qt/5.2.1/mingw48_32/include/QtSql/5.2.1' -I'C:/Qt/5.2.1
  9. /mingw48_32/include/QtSql/5.2.1/QtSql' -I'C:/Qt/5.2.1/mingw48_32/include' -I'C:/
  10. Qt/5.2.1/mingw48_32/include/QtSql' -I'C:/Qt/5.2.1/mingw48_32/include/QtCore/5.2.
  11. 1' -I'C:/Qt/5.2.1/mingw48_32/include/QtCore/5.2.1/QtCore' -I'C:/Qt/5.2.1/mingw48
  12. _32/include/QtCore' -I'.moc/release' -I'C:/PROGRA~1/IBM/SQLLIB/INCLUDE' -I'C:/PR
  13. OGRA~1/IBM/SQLLIB/LIB' -I'C:/Python27/include' -I'C:/Python27' -I'../../../../mk
  14. specs/win32-g++' -o .obj/release/qsql_db2.o ../../../sql/drivers/db2/qsql_db2.cp
  15. p
  16. ../../../sql/drivers/db2/qsql_db2.cpp:63:0: warning: "UNICODE" redefined [enable
  17. d by default]
  18. #define UNICODE
  19. ^
  20. <command-line>:0:0: note: this is the location of the previous definition
  21. In file included from C:/PROGRA~1/IBM/sqllib/include/sqlcli.h:983:0,
  22. from C:/PROGRA~1/IBM/sqllib/include/sqlcli1.h:45,
  23. from ../../../sql/drivers/db2/qsql_db2.cpp:65:
  24. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1747:5: error: '__in_ecount' has not bee
  25. n declared
  26. __in_ecount(cchConnStrIn)
  27. ^
  28. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1748:5: error: expected ',' or '...' bef
  29. ore 'SQLCHAR'
  30. SQLCHAR *szConnStrIn,
  31. ^
  32. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1864:5: error: '__in_ecount' has not bee
  33. n declared
  34. __in_ecount(cchConnStrIn)
  35. ^
  36. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1865:5: error: expected ',' or '...' bef
  37. ore 'SQLCHAR'
  38. SQLCHAR *szConnStrIn,
  39. ^
  40. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1890:5: error: '__in_ecount_opt' has not
  41. been declared
  42. __in_ecount_opt(cchCatalogName)
  43. ^
  44. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1891:5: error: expected ',' or '...' bef
  45. ore 'SQLCHAR'
  46. SQLCHAR *szCatalogName,
  47. ^
  48. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1906:5: error: '__out_opt' has not been
  49. declared
  50. __out_opt
  51. ^
  52. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1907:23: error: expected ',' or '...' be
  53. fore '*' token
  54. SQLSMALLINT *pfSqlType,
  55. ^
  56. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1919:5: error: '__out_opt' has not been
  57. declared
  58. __out_opt
  59. ^
  60. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1920:23: error: expected ',' or '...' be
  61. fore '*' token
  62. SQLULEN *pcrow,
  63. ^
  64. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1926:5: error: '__in_ecount_opt' has not
  65. been declared
  66. __in_ecount_opt(cchPkCatalogName)
  67. ^
  68. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1927:5: error: expected ',' or '...' bef
  69. ore 'SQLCHAR'
  70. SQLCHAR *szPkCatalogName,
  71. ^
  72. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1951:5: error: '__in_ecount' has not bee
  73. n declared
  74. __in_ecount(cchSqlStrIn) SQLCHAR* szSqlStrIn,
  75. ^
  76. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1951:30: error: expected ',' or '...' be
  77. fore 'SQLCHAR'
  78. __in_ecount(cchSqlStrIn) SQLCHAR* szSqlStrIn,
  79. ^
  80. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1960:5: error: '__out_opt' has not been
  81. declared
  82. __out_opt
  83. ^
  84. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1961:23: error: expected ',' or '...' be
  85. fore '*' token
  86. SQLSMALLINT *pcpar);
  87. ^
  88. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1970:5: error: '__in_ecount_opt' has not
  89. been declared
  90. __in_ecount_opt(cchCatalogName)
  91. ^
  92. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1971:5: error: expected ',' or '...' bef
  93. ore 'SQLCHAR'
  94. SQLCHAR *szCatalogName,
  95. ^
  96. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1982:5: error: '__in_ecount_opt' has not
  97. been declared
  98. __in_ecount_opt(cchCatalogName)
  99. ^
  100. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1983:5: error: expected ',' or '...' bef
  101. ore 'SQLCHAR'
  102. SQLCHAR *szCatalogName,
  103. ^
  104. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1997:5: error: '__in_ecount_opt' has not
  105. been declared
  106. __in_ecount_opt(cchCatalogName)
  107. ^
  108. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:1998:5: error: expected ',' or '...' bef
  109. ore 'SQLCHAR'
  110. SQLCHAR *szCatalogName,
  111. ^
  112. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2017:5: error: '__in_ecount_opt' has not
  113. been declared
  114. __in_ecount_opt(cchCatalogName)
  115. ^
  116. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2018:5: error: expected ',' or '...' bef
  117. ore 'SQLCHAR'
  118. SQLCHAR *szCatalogName,
  119. ^
  120. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2030:5: error: '__out_ecount_opt' has no
  121. t been declared
  122. __out_ecount_opt(cchDriverDescMax)
  123. ^
  124. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2031:5: error: expected ',' or '...' bef
  125. ore 'SQLCHAR'
  126. SQLCHAR *szDriverDesc,
  127. ^
  128. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2086:5: error: '__out' has not been decl
  129. ared
  130. __out
  131. ^
  132. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2087:20: error: expected ',' or '...' be
  133. fore '*' token
  134. SQLHANDLE *phOutput);
  135. ^
  136. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2127:5: warning: '__stdcall__' attribute
  137. only applies to function types [-Wattributes]
  138. __in_opt LPWSTR szFileName,
  139. ^
  140. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2127:5: error: '__in_opt' was not declar
  141. ed in this scope
  142. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2128:22: error: 'cbOutputMsg' was not de
  143. clared in this scope
  144. __out_bcount_opt(cbOutputMsg) LPWSTR lpwszOutputMsg,
  145. ^
  146. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2128:33: error: '__out_bcount_opt' was n
  147. ot declared in this scope
  148. __out_bcount_opt(cbOutputMsg) LPWSTR lpwszOutputMsg,
  149. ^
  150. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2129:5: error: '__in' was not declared i
  151. n this scope
  152. __in DWORD cbOutputMsg
  153. ^
  154. C:/PROGRA~1/IBM/sqllib/include/sqlext.h:2130:1: error: expression list treated a
  155. s compound expression in initializer [-fpermissive]
  156. );
  157. ^
  158. ../../../sql/drivers/db2/qsql_db2.cpp: In member function 'virtual bool QDB2Driv
  159. er::hasFeature(QSqlDriver::DriverFeature) const':
  160. ../../../sql/drivers/db2/qsql_db2.cpp:1510:12: warning: enumeration value 'Cance
  161. lQuery' not handled in switch [-Wswitch]
  162. switch (f) {
  163. ^
  164. Makefile.Release:500: recipe for target '.obj/release/qsql_db2.o' failed
  165. mingw32-make[1]: *** [.obj/release/qsql_db2.o] Error 1
  166. mingw32-make[1]: Leaving directory 'C:/Qt/5.2.1/Src/qtbase/src/plugins/sqldriver
  167. s/db2'
  168. makefile:38: recipe for target 'release-all' failed
  169. mingw32-make: *** [release-all] Error 2
To copy to clipboard, switch view to plain text mode 

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