Page 1 of 4 123 ... LastLast
Results 1 to 20 of 61

Thread: QPSQL problem

  1. #1
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default QPSQL problem

    Hi guys,
    I am trying to connect qt in postgresql and it appears "DRIVER NOT LOADED DRIVER NOT LOADED". Why that?

    PostgreSQL 8.3
    Qt 4.3.3

    My code:

    Qt Code:
    1. #include <QApplication>
    2. #include <QtSql>
    3. #include <QSqlDriver>
    4. #include <QSqlDatabase>
    5. #include <QMessageBox>
    6. #include <QObject>
    7.  
    8. bool createConnection() {
    9.  
    10. QSqlDatabase bd = QSqlDatabase::addDatabase("QPSQL");
    11. bd.setHostName("localhost");
    12. bd.setDatabaseName("Test");
    13. if(!bd.open()) {
    14. QMessageBox::critical(0, QObject::tr("DB - ERROR!"),
    15. bd.lastError().text());
    16. return false;
    17. }
    18. return true;
    19.  
    20. }
    21.  
    22. int main(int argc, char *argv[]) {
    23.  
    24. QApplication app(argc, argv);
    25. if(!createConnection())
    26. return 1;
    27.  
    28. return app.exec();
    29. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    ERROR IN CONSOLE AFTER MAKE:

    ERROR in console:
    Qt Code:
    1. mingw32-make -f Makefile.Debug all
    2. mingw32-make[1]: Entering directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    3. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    4. DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
    5. DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\i
    6. nclude\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..
    7. \..\..\..\include" -I"c:\Program" -I"Files\Programas\PostgreSQL\lib" -I"c:\Qt\4.
    8. 3.3\include\ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"..\..\..\..\mkspecs\win3
    9. 2-g++" -o tmp\obj\debug_shared\qsql_psql.o ..\..\..\sql\drivers\psql\qsql_psql.c
    10. pp
    11. ..\..\..\sql\drivers\psql\qsql_psql.cpp:50:22: libpq-fe.h: No such file or direc
    12. tory
    13. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In function `QSqlError qMakeError(const
    14. QString&, QSqlError::ErrorType, const QPSQLDriverPrivate*)':
    15. ..\..\..\sql\drivers\psql\qsql_psql.cpp:140: error: `PQerrorMessage' undeclared
    16. (first use this function)
    17. ..\..\..\sql\drivers\psql\qsql_psql.cpp:140: error: (Each undeclared identifier
    18. is reported only once for each function it appears in.)
    19. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `bool QPSQLResultPri
    20. vate::processResults()':
    21. ..\..\..\sql\drivers\psql\qsql_psql.cpp:150: error: `PQresultStatus' undeclared
    22. (first use this function)
    23. ..\..\..\sql\drivers\psql\qsql_psql.cpp:151: error: `PGRES_TUPLES_OK' undeclared
    24. (first use this function)
    25. ..\..\..\sql\drivers\psql\qsql_psql.cpp:154: error: `PQntuples' undeclared (firs
    26. t use this function)
    27. ..\..\..\sql\drivers\psql\qsql_psql.cpp:156: error: `PGRES_COMMAND_OK' undeclare
    28. d (first use this function)
    29. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `void QPSQLResult::c
    30. leanup()':
    31. ..\..\..\sql\drivers\psql\qsql_psql.cpp:234: error: `PQclear' undeclared (first
    32. use this function)
    33. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLR
    34. esult::fetchLast()':
    35. ..\..\..\sql\drivers\psql\qsql_psql.cpp:262: error: `PQntuples' undeclared (firs
    36. t use this function)
    37. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual QVariant QP
    38. SQLResult::data(int)':
    39. ..\..\..\sql\drivers\psql\qsql_psql.cpp:267: error: `PQnfields' undeclared (firs
    40. t use this function)
    41. ..\..\..\sql\drivers\psql\qsql_psql.cpp:271: error: `PQftype' undeclared (first
    42. use this function)
    43. ..\..\..\sql\drivers\psql\qsql_psql.cpp:273: error: `PQgetvalue' undeclared (fir
    44. st use this function)
    45. ..\..\..\sql\drivers\psql\qsql_psql.cpp:274: error: `PQgetisnull' undeclared (fi
    46. rst use this function)
    47. ..\..\..\sql\drivers\psql\qsql_psql.cpp:336: error: `PQunescapeBytea' undeclared
    48. (first use this function)
    49. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLR
    50. esult::isNull(int)':
    51. ..\..\..\sql\drivers\psql\qsql_psql.cpp:350: error: `PQgetvalue' undeclared (fir
    52. st use this function)
    53. ..\..\..\sql\drivers\psql\qsql_psql.cpp:351: error: `PQgetisnull' undeclared (fi
    54. rst use this function)
    55. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLR
    56. esult::reset(const QString&)':
    57. ..\..\..\sql\drivers\psql\qsql_psql.cpp:363: error: `PQexec' undeclared (first u
    58. se this function)
    59. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual int QPSQLRe
    60. sult::numRowsAffected()':
    61. ..\..\..\sql\drivers\psql\qsql_psql.cpp:374: error: `PQcmdTuples' undeclared (fi
    62. rst use this function)
    63. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual QVariant QP
    64. SQLResult::lastInsertId() const':
    65. ..\..\..\sql\drivers\psql\qsql_psql.cpp:380: error: `Oid' undeclared (first use
    66. this function)
    67. ..\..\..\sql\drivers\psql\qsql_psql.cpp:380: error: expected `;' before "id"
    68. ..\..\..\sql\drivers\psql\qsql_psql.cpp:381: error: `id' undeclared (first use t
    69. his function)
    70. ..\..\..\sql\drivers\psql\qsql_psql.cpp:381: error: `InvalidOid' undeclared (fir
    71. st use this function)
    72. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual QSqlRecord
    73. QPSQLResult::record() const':
    74. ..\..\..\sql\drivers\psql\qsql_psql.cpp:393: error: `PQnfields' undeclared (firs
    75. t use this function)
    76. ..\..\..\sql\drivers\psql\qsql_psql.cpp:397: error: `PQfname' undeclared (first
    77. use this function)
    78. ..\..\..\sql\drivers\psql\qsql_psql.cpp:400: error: `PQftype' undeclared (first
    79. use this function)
    80. ..\..\..\sql\drivers\psql\qsql_psql.cpp:401: error: `PQfsize' undeclared (first
    81. use this function)
    82. ..\..\..\sql\drivers\psql\qsql_psql.cpp:402: error: `PQfmod' undeclared (first u
    83. se this function)
    84. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In function `bool setEncodingUtf8(PGcon
    85. n*)':
    86. ..\..\..\sql\drivers\psql\qsql_psql.cpp:420: error: `PQexec' undeclared (first u
    87. se this function)
    88. ..\..\..\sql\drivers\psql\qsql_psql.cpp:421: error: `PQresultStatus' undeclared
    89. (first use this function)
    90. ..\..\..\sql\drivers\psql\qsql_psql.cpp:422: error: `PQclear' undeclared (first
    91. use this function)
    92. ..\..\..\sql\drivers\psql\qsql_psql.cpp:423: error: `PGRES_COMMAND_OK' undeclare
    93. d (first use this function)
    94. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In function `void setDatestyle(PGconn*)
    95. ':
    96. ..\..\..\sql\drivers\psql\qsql_psql.cpp:428: error: `PQexec' undeclared (first u
    97. se this function)
    98. ..\..\..\sql\drivers\psql\qsql_psql.cpp:429: error: `PQresultStatus' undeclared
    99. (first use this function)
    100. ..\..\..\sql\drivers\psql\qsql_psql.cpp:430: error: `PGRES_COMMAND_OK' undeclare
    101. d (first use this function)
    102. ..\..\..\sql\drivers\psql\qsql_psql.cpp:431: error: `PQerrorMessage' undeclared
    103. (first use this function)
    104. ..\..\..\sql\drivers\psql\qsql_psql.cpp:432: error: `PQclear' undeclared (first
    105. use this function)
    106. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In function `QPSQLDriver::Protocol getP
    107. SQLVersion(PGconn*)':
    108. ..\..\..\sql\drivers\psql\qsql_psql.cpp:437: error: `PQexec' undeclared (first u
    109. se this function)
    110. ..\..\..\sql\drivers\psql\qsql_psql.cpp:438: error: `PQresultStatus' undeclared
    111. (first use this function)
    112. ..\..\..\sql\drivers\psql\qsql_psql.cpp:439: error: `PGRES_COMMAND_OK' undeclare
    113. d (first use this function)
    114. ..\..\..\sql\drivers\psql\qsql_psql.cpp:439: error: `PGRES_TUPLES_OK' undeclared
    115. (first use this function)
    116. ..\..\..\sql\drivers\psql\qsql_psql.cpp:440: error: `PQgetvalue' undeclared (fir
    117. st use this function)
    118. ..\..\..\sql\drivers\psql\qsql_psql.cpp:441: error: `PQclear' undeclared (first
    119. use this function)
    120. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In destructor `virtual QPSQLDriver::~QP
    121. SQLDriver()':
    122. ..\..\..\sql\drivers\psql\qsql_psql.cpp:494: error: `PQfinish' undeclared (first
    123. use this function)
    124. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLD
    125. river::open(const QString&, const QString&, const QString&, const QString&, int,
    126. const QString&)':
    127. ..\..\..\sql\drivers\psql\qsql_psql.cpp:567: error: `PQconnectdb' undeclared (fi
    128. rst use this function)
    129. ..\..\..\sql\drivers\psql\qsql_psql.cpp:568: error: `PQstatus' undeclared (first
    130. use this function)
    131. ..\..\..\sql\drivers\psql\qsql_psql.cpp:568: error: `CONNECTION_BAD' undeclared
    132. (first use this function)
    133. ..\..\..\sql\drivers\psql\qsql_psql.cpp:569: error: `PQfinish' undeclared (first
    134. use this function)
    135. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual void QPSQLD
    136. river::close()':
    137. ..\..\..\sql\drivers\psql\qsql_psql.cpp:589: error: `PQfinish' undeclared (first
    138. use this function)
    139. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLD
    140. river::beginTransaction()':
    141. ..\..\..\sql\drivers\psql\qsql_psql.cpp:607: error: `PQexec' undeclared (first u
    142. se this function)
    143. ..\..\..\sql\drivers\psql\qsql_psql.cpp:608: error: `PQresultStatus' undeclared
    144. (first use this function)
    145. ..\..\..\sql\drivers\psql\qsql_psql.cpp:608: error: `PGRES_COMMAND_OK' undeclare
    146. d (first use this function)
    147. ..\..\..\sql\drivers\psql\qsql_psql.cpp:609: error: `PQclear' undeclared (first
    148. use this function)
    149. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLD
    150. river::commitTransaction()':
    151. ..\..\..\sql\drivers\psql\qsql_psql.cpp:624: error: `PQexec' undeclared (first u
    152. se this function)
    153. ..\..\..\sql\drivers\psql\qsql_psql.cpp:625: error: `PQresultStatus' undeclared
    154. (first use this function)
    155. ..\..\..\sql\drivers\psql\qsql_psql.cpp:625: error: `PGRES_COMMAND_OK' undeclare
    156. d (first use this function)
    157. ..\..\..\sql\drivers\psql\qsql_psql.cpp:626: error: `PQclear' undeclared (first
    158. use this function)
    159. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLD
    160. river::rollbackTransaction()':
    161. ..\..\..\sql\drivers\psql\qsql_psql.cpp:641: error: `PQexec' undeclared (first u
    162. se this function)
    163. ..\..\..\sql\drivers\psql\qsql_psql.cpp:642: error: `PQresultStatus' undeclared
    164. (first use this function)
    165. ..\..\..\sql\drivers\psql\qsql_psql.cpp:642: error: `PGRES_COMMAND_OK' undeclare
    166. d (first use this function)
    167. ..\..\..\sql\drivers\psql\qsql_psql.cpp:645: error: `PQclear' undeclared (first
    168. use this function)
    169. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual QString QPS
    170. QLDriver::formatValue(const QSqlField&, bool) const':
    171. ..\..\..\sql\drivers\psql\qsql_psql.cpp:913: error: `PQescapeBytea' undeclared (
    172. first use this function)
    173. ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function `virtual bool QPSQLD
    174. river::isOpen() const':
    175. ..\..\..\sql\drivers\psql\qsql_psql.cpp:939: error: `PQstatus' undeclared (first
    176. use this function)
    177. ..\..\..\sql\drivers\psql\qsql_psql.cpp:939: error: `CONNECTION_OK' undeclared (
    178. first use this function)
    179. mingw32-make[1]: *** [tmp/obj/debug_shared/qsql_psql.o] Error 1
    180. mingw32-make[1]: Leaving directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    181. mingw32-make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 


    What can I do?

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    First of all, you need to install a PSQL development package (which provides required headers and libraries). Secondly, you need to pass suitable INCLUDEPATH and LIBS as parameters to qmake like advised in this article: How to Build the QPSQL Plugin on Windows.
    J-P Nurmi

  4. #4
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Hey,

    Where do I find PSQL development package?

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    I believe it's the core distribution package from http://www.postgresql.org/download/.
    J-P Nurmi

  6. #6
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Hey,

    What file/files do I download? ftp://ftp2.br.postgresql.org/postgresql/
    I am lost.

    hugs.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Try downloading ftp://ftp.fi.postgresql.org/pub/post...ql-8.3.0-1.zip.

    In Installation Options, make sure to select "Include files" and "Library files" under "Development" section.

    To avoid common space problems, you might also want to change the default installation path ("C:\Program Files\PostgreSQL\8.3") not to contain spaces (eg. "C:\psql").

    Change to directory $QTDIR\src\plugins\sqldrivers\psql and follow given instructions: How to Build the QPSQL Plugin on Windows.
    J-P Nurmi

  8. #8
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Done, but some problems yet!

    Reinstalled postgresql in c:/psql, but its not exists ms folder in /lib. "libpq.lib" is in /lib.

    So...when I did:
    Qt Code:
    1. cd %QTDIR%\src\plugins\sqldrivers\psql
    2. qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro
    3. make
    To copy to clipboard, switch view to plain text mode 

    Error:
    Qt Code:
    1. mingw32-make -f Makefile.Debug all
    2. mingw32-make[1]: Entering directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    3. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    4. oc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\4.3.3\plugins\sqldrivers\libqsql
    5. psqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll tmp/obj/debug_shared/m
    6. ain.o tmp/obj/debug_shared/qsql_psql.o tmp/obj/debug_shared/moc_qsql_psql.o -L"
    7. c:\Qt\4.3.3\lib" -L"c:\Qt\4.3.3\lib" tmp\obj\debug_shared\qsqlpsqld_resource_res
    8. .o C:\psql\lib\ms\libpq.lib -lQtSqld4 -lQtCored4
    9. g++: C:\psql\lib\ms\libpq.lib: No such file or directory
    10. mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll] Error 1
    11. mingw32-make[1]: Leaving directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    12. mingw32-make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 

    So I tried:
    Qt Code:
    1. cd %QTDIR%\src\plugins\sqldrivers\psql
    2. qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\libpq.lib" psql.pro
    3. make
    To copy to clipboard, switch view to plain text mode 

    ERROR:
    Qt Code:
    1. mingw32-make -f Makefile.Debug all
    2. mingw32-make[1]: Entering directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    3. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    4. oc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\4.3.3\plugins\sqldrivers\libqsql
    5. psqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll tmp/obj/debug_shared/m
    6. ain.o tmp/obj/debug_shared/qsql_psql.o tmp/obj/debug_shared/moc_qsql_psql.o -L"
    7. c:\Qt\4.3.3\lib" -L"c:\Qt\4.3.3\lib" tmp\obj\debug_shared\qsqlpsqld_resource_res
    8. .o C:\psql\lib\libpq.lib -lQtSqld4 -lQtCored4
    9. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    10. d -lQtSqld4
    11. collect2: ld returned 1 exit status
    12. mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll] Error 1
    13. mingw32-make[1]: Leaving directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    14. mingw32-make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 

    What is that?

    Thanks.
    Hugs.

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Argh, sorry. I didn't realize they were MSVC libs but you're using MinGW. Try converting them as MinGW libs (.lib -> .a) with reimp like it's done in this wiki article: [wiki]Building the QMYSQL plugin on Windows using MinGW[/wiki]
    J-P Nurmi

  10. #10
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Qt Code:
    1. C:\psql\lib>reimp libpq.lib
    2. 'reimp' is not recognized as an internal or external command, operable program or batch file.
    To copy to clipboard, switch view to plain text mode 

    Did I do something wrong?

    ps.: My O.S. is Windows Vista.

  11. #11
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    reimp is part of mingw-utils
    J-P Nurmi

  12. #12
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    ERROR:
    Qt Code:
    1. C:\psql\lib>reimp libpq.lib
    2.  
    3. C:\Qt\4.3.3\src\plugins\sqldrivers\psql>qmake -o Makefile "INCLUDEPATH+=C:\psql\
    4. include" "LIBS+=C:\psql\lib\liblibpq.a" psql.pro
    5.  
    6. C:\Qt\4.3.3\src\plugins\sqldrivers\psql>make
    7. mingw32-make -f Makefile.Debug all
    8. mingw32-make[1]: Entering directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    9. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    10. oc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\4.3.3\plugins\sqldrivers\libqsql
    11. psqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll tmp/obj/debug_shared/m
    12. ain.o tmp/obj/debug_shared/qsql_psql.o tmp/obj/debug_shared/moc_qsql_psql.o -L"
    13. c:\Qt\4.3.3\lib" -L"c:\Qt\4.3.3\lib" tmp\obj\debug_shared\qsqlpsqld_resource_res
    14. .o C:\psql\lib\liblibpq.a -lQtSqld4 -lQtCored4
    15. C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    16. d -lQtSqld4
    17. collect2: ld returned 1 exit status
    18. mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll] Error 1
    19. mingw32-make[1]: Leaving directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    20. mingw32-make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 


    Qt Code:
    1. C:\psql\lib>reimp libpq.lib
    To copy to clipboard, switch view to plain text mode 

    is it libpq.lib or another .lib file?

    Suggestion?

  13. #13
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Quote Originally Posted by LoneWolf View Post
    cannot find -lQtSqld4
    Ok, we're getting closer. Now the problem is that you're trying to compile something in debug mode but you don't have debug version of Qt built. I recommend you build the plugin in release mode instead:
    Qt Code:
    1. qmake -config release -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\liblibpq.a" psql.pro
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  14. #14
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Yeah, closer and closer...

    So, I did:
    Qt Code:
    1. C:\Qt\4.3.3\src\plugins\sqldrivers\psql>qmake -config release -o Makefile "INCLU
    2. DEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\liblibpq.a" psql.pro
    To copy to clipboard, switch view to plain text mode 

    And:
    Qt Code:
    1. C:\Qt\4.3.3\src\plugins\sqldrivers\psql>make
    To copy to clipboard, switch view to plain text mode 

    In beginning it was all right, but after that...
    ERROR:
    Qt Code:
    1. Creating library file: c:\Qt\4.3.3\plugins\sqldrivers\libqsqlpsql4.a
    2. tmp/obj/release_shared/qsql_psql.o(.text+0x54):qsql_psql.cpp: undefined referenc
    3. e to `PQerrorMessage'
    4. tmp/obj/release_shared/qsql_psql.o(.text+0x32b):qsql_psql.cpp: undefined referen
    5. ce to `PQresultStatus'
    6. tmp/obj/release_shared/qsql_psql.o(.text+0x4f0):qsql_psql.cpp: undefined referen
    7. ce to `PQntuples'
    8. tmp/obj/release_shared/qsql_psql.o(.text+0x834):qsql_psql.cpp: undefined referen
    9. ce to `PQclear'
    10. tmp/obj/release_shared/qsql_psql.o(.text+0xb34):qsql_psql.cpp: undefined referen
    11. ce to `PQntuples'
    12. tmp/obj/release_shared/qsql_psql.o(.text+0xbac):qsql_psql.cpp: undefined referen
    13. ce to `PQnfields'
    14. tmp/obj/release_shared/qsql_psql.o(.text+0xc22):qsql_psql.cpp: undefined referen
    15. ce to `PQftype'
    16. tmp/obj/release_shared/qsql_psql.o(.text+0xc61):qsql_psql.cpp: undefined referen
    17. ce to `PQgetvalue'
    18. tmp/obj/release_shared/qsql_psql.o(.text+0xc95):qsql_psql.cpp: undefined referen
    19. ce to `PQgetisnull'
    20. tmp/obj/release_shared/qsql_psql.o(.text+0xe2c):qsql_psql.cpp: undefined referen
    21. ce to `PQunescapeBytea'
    22. tmp/obj/release_shared/qsql_psql.o(.text+0xe6b):qsql_psql.cpp: undefined referen
    23. ce to `PQfreemem'
    24. tmp/obj/release_shared/qsql_psql.o(.text+0x15d9):qsql_psql.cpp: undefined refere
    25. nce to `PQgetvalue'
    26. tmp/obj/release_shared/qsql_psql.o(.text+0x15f8):qsql_psql.cpp: undefined refere
    27. nce to `PQgetisnull'
    28. tmp/obj/release_shared/qsql_psql.o(.text+0x1765):qsql_psql.cpp: undefined refere
    29. nce to `PQexec'
    30. tmp/obj/release_shared/qsql_psql.o(.text+0x1936):qsql_psql.cpp: undefined refere
    31. nce to `PQcmdTuples'
    32. tmp/obj/release_shared/qsql_psql.o(.text+0x1a6f):qsql_psql.cpp: undefined refere
    33. nce to `PQoidValue'
    34. tmp/obj/release_shared/qsql_psql.o(.text+0x1c1a):qsql_psql.cpp: undefined refere
    35. nce to `PQnfields'
    36. tmp/obj/release_shared/qsql_psql.o(.text+0x1cc2):qsql_psql.cpp: undefined refere
    37. nce to `PQfname'
    38. tmp/obj/release_shared/qsql_psql.o(.text+0x1d3a):qsql_psql.cpp: undefined refere
    39. nce to `PQftype'
    40. tmp/obj/release_shared/qsql_psql.o(.text+0x1d6a):qsql_psql.cpp: undefined refere
    41. nce to `PQfsize'
    42. tmp/obj/release_shared/qsql_psql.o(.text+0x1d8b):qsql_psql.cpp: undefined refere
    43. nce to `PQfmod'
    44. tmp/obj/release_shared/qsql_psql.o(.text+0x1e0d):qsql_psql.cpp: undefined refere
    45. nce to `PQftype'
    46. tmp/obj/release_shared/qsql_psql.o(.text+0x1e83):qsql_psql.cpp: undefined refere
    47. nce to `PQfname'
    48. tmp/obj/release_shared/qsql_psql.o(.text+0x1f45):qsql_psql.cpp: undefined refere
    49. nce to `PQexec'
    50. tmp/obj/release_shared/qsql_psql.o(.text+0x1f53):qsql_psql.cpp: undefined refere
    51. nce to `PQresultStatus'
    52. tmp/obj/release_shared/qsql_psql.o(.text+0x1f7c):qsql_psql.cpp: undefined refere
    53. nce to `PQgetvalue'
    54. tmp/obj/release_shared/qsql_psql.o(.text+0x1fa8):qsql_psql.cpp: undefined refere
    55. nce to `PQclear'
    56. tmp/obj/release_shared/qsql_psql.o(.text+0x27cb):qsql_psql.cpp: undefined refere
    57. nce to `PQfinish'
    58. tmp/obj/release_shared/qsql_psql.o(.text+0x289b):qsql_psql.cpp: undefined refere
    59. nce to `PQfinish'
    60. tmp/obj/release_shared/qsql_psql.o(.text+0x296b):qsql_psql.cpp: undefined refere
    61. nce to `PQfinish'
    62. tmp/obj/release_shared/qsql_psql.o(.text+0x2eab):qsql_psql.cpp: undefined refere
    63. nce to `PQconnectdb'
    64. tmp/obj/release_shared/qsql_psql.o(.text+0x2efc):qsql_psql.cpp: undefined refere
    65. nce to `PQstatus'
    66. tmp/obj/release_shared/qsql_psql.o(.text+0x2f4f):qsql_psql.cpp: undefined refere
    67. nce to `PQexec'
    68. tmp/obj/release_shared/qsql_psql.o(.text+0x2f5d):qsql_psql.cpp: undefined refere
    69. nce to `PQresultStatus'
    70. tmp/obj/release_shared/qsql_psql.o(.text+0x2f71):qsql_psql.cpp: undefined refere
    71. nce to `PQclear'
    72. tmp/obj/release_shared/qsql_psql.o(.text+0x2fa4):qsql_psql.cpp: undefined refere
    73. nce to `PQexec'
    74. tmp/obj/release_shared/qsql_psql.o(.text+0x2fb2):qsql_psql.cpp: undefined refere
    75. nce to `PQresultStatus'
    76. tmp/obj/release_shared/qsql_psql.o(.text+0x2fc3):qsql_psql.cpp: undefined refere
    77. nce to `PQerrorMessage'
    78. tmp/obj/release_shared/qsql_psql.o(.text+0x2fed):qsql_psql.cpp: undefined refere
    79. nce to `PQclear'
    80. tmp/obj/release_shared/qsql_psql.o(.text+0x35c8):qsql_psql.cpp: undefined refere
    81. nce to `PQfinish'
    82. tmp/obj/release_shared/qsql_psql.o(.text+0x373b):qsql_psql.cpp: undefined refere
    83. nce to `PQfinish'
    84. tmp/obj/release_shared/qsql_psql.o(.text+0x38cc):qsql_psql.cpp: undefined refere
    85. nce to `PQexec'
    86. tmp/obj/release_shared/qsql_psql.o(.text+0x38db):qsql_psql.cpp: undefined refere
    87. nce to `PQresultStatus'
    88. tmp/obj/release_shared/qsql_psql.o(.text+0x3900):qsql_psql.cpp: undefined refere
    89. nce to `PQclear'
    90. tmp/obj/release_shared/qsql_psql.o(.text+0x3a0d):qsql_psql.cpp: undefined refere
    91. nce to `PQclear'
    92. tmp/obj/release_shared/qsql_psql.o(.text+0x3abc):qsql_psql.cpp: undefined refere
    93. nce to `PQexec'
    94. tmp/obj/release_shared/qsql_psql.o(.text+0x3acb):qsql_psql.cpp: undefined refere
    95. nce to `PQresultStatus'
    96. tmp/obj/release_shared/qsql_psql.o(.text+0x3ae4):qsql_psql.cpp: undefined refere
    97. nce to `PQclear'
    98. tmp/obj/release_shared/qsql_psql.o(.text+0x3bfd):qsql_psql.cpp: undefined refere
    99. nce to `PQclear'
    100. tmp/obj/release_shared/qsql_psql.o(.text+0x3cac):qsql_psql.cpp: undefined refere
    101. nce to `PQexec'
    102. tmp/obj/release_shared/qsql_psql.o(.text+0x3cbb):qsql_psql.cpp: undefined refere
    103. nce to `PQresultStatus'
    104. tmp/obj/release_shared/qsql_psql.o(.text+0x3d74):qsql_psql.cpp: undefined refere
    105. nce to `PQclear'
    106. tmp/obj/release_shared/qsql_psql.o(.text+0x3dec):qsql_psql.cpp: undefined refere
    107. nce to `PQclear'
    108. tmp/obj/release_shared/qsql_psql.o(.text+0x8048):qsql_psql.cpp: undefined refere
    109. nce to `PQescapeBytea'
    110. tmp/obj/release_shared/qsql_psql.o(.text+0x80a4):qsql_psql.cpp: undefined refere
    111. nce to `PQfreemem'
    112. tmp/obj/release_shared/qsql_psql.o(.text+0x8612):qsql_psql.cpp: undefined refere
    113. nce to `PQstatus'
    114. collect2: ld returned 1 exit status
    115. mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsql4.dll] Error 1
    116. mingw32-make[1]: Leaving directory `C:/Qt/4.3.3/src/plugins/sqldrivers/psql'
    117. mingw32-make: *** [release-all] Error 2
    To copy to clipboard, switch view to plain text mode 

    Thanks !

  15. #15
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Looks like it doesn't find required symbols in libpq.a. Anyway, I'm sorry but I don't know where's the problem, with reimp or what... I guess you could try compiling whole PSQL with MinGW (you might need MSYS for that) unless you can find readily available binaries somewhere on the internet.
    J-P Nurmi

  16. #16
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    I dont know how MSYS works. Somebody has some idea? How do I clean all files created after my commands? So, I can try to do everything again.

    Thanks.
    Hugs.

  17. #17
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Quote Originally Posted by LoneWolf View Post
    How do I clean all files created after my commands? So, I can try to do everything again.
    Try "make distclean".
    J-P Nurmi

  18. #18
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    After that command, can I build QT in debug mode ?

  19. #19
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPSQL problem

    Did you install Qt from a binary installer? If so, there's a link in Start-menu for building debug libs. But still, it won't solve the original problem...
    J-P Nurmi

  20. #20
    Join Date
    Mar 2008
    Posts
    37
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPSQL problem

    Oh...so I will not lose my time....hehehhee
    is it really libpq.lib? Cause there is a postgres.lib and anothers .libs in psql/lib.

    How do -L and -I parameters work?

Similar Threads

  1. problem with opengl, zooming, drawpixels, and origin
    By ntp in forum General Programming
    Replies: 0
    Last Post: 22nd February 2008, 21:48
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. QPSQL plugin problem
    By tuxi in forum Qt Programming
    Replies: 0
    Last Post: 12th March 2007, 20:44
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.