[Qt-interest] [Qt-creator] Help me using mysql with qt-creator

Jaco Naude naude.jaco at gmail.com
Mon Aug 3 09:09:05 CEST 2009


I've had the problem once where Mingw32 didn't find any Qt classes.
Check that you have only sources under SOURCES += and only headers
under HEADERS += in your .pro file.

But since you didn't post any error messages I can't tell if its the
same problem that I had.

Funny thing is, someone already told you to please post error messages
in this thread.

On Mon, Aug 3, 2009 at 6:28 AM, Aditya Sharma<88aditya88 at gmail.com> wrote:
> I think I did what it was told in
> http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/
>
> But now, I have a big problem, Qt-creator doesn't even find any of the
> library classes like QtGui QMainWindow and such..
> What is happening with me :(
>
> On Mon, Aug 3, 2009 at 7:35 AM, Efrain Lopez <tecnomaya at cabsagt.com> wrote:
>>
>> Try
>> open again the mysql.pro file
>>
>> Clean Project
>> Run qmake
>>
>>
>> El 2/08/2009, a las 06:59 p.m., Aditya Sharma escribió:
>>
>> I did exactly what you said. But I got 24 errors in qt-creator.
>>
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/tmp/obj/debug_shared/qsql_mysql.o:-1:
>> error: In function `Z5codecP8st_mysql':
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:216:
>> undefined reference to `mysql_character_set_name at 4'
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/tmp/obj/debug_shared/qsql_mysql.o:-1:
>> error: In function
>> `Z10qMakeErrorRK7QStringN9QSqlError9ErrorTypeEPK19QMYSQLDriverPrivate':
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:227:
>> undefined reference to `mysql_error at 4'
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/tmp/obj/debug_shared/qsql_mysql.o:-1:
>> error: In function
>> `Z14qMakeStmtErrorRK7QStringN9QSqlError9ErrorTypeEP13st_mysql_stmt':
>>
>> C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:299:
>> undefined reference to `mysql_stmt_error at 4'
>>
>> .....
>> and lot more making a total count to 24. Now what should i do?
>>
>> :(
>>
>> On Mon, Aug 3, 2009 at 6:30 AM, Efrain Lopez <tecnomaya at cabsagt.com>
>> wrote:
>>>
>>> If
>>> - QtCreator is working for you
>>> - You installed Mysql libs and includes files
>>> - They sould be somewhere like this
>>> Include files:  C:/Program files/MySQL/MySQL Server 5.1/Include
>>> Lib files:     C:/Program files/MySQL/MySQL Server 5.1/lib/opt
>>>
>>> Try this:
>>> 1. Open the project:  %QTDIR%/src/plugins/sqldrivers/mysql/mysql.pro
>>> ( with QtCreator)
>>> 2. Edit the file mysql.pro, add this at the end, but check if the path
>>> below are ok  ( in my computer is C:/Archivos de programas/ ... etc)
>>> INCLUDEPATH += "C:/Program files/MySQL/MySQL Server 5.1/include"
>>> LIBS += -L"C:/Program files/MySQL/MySQL Server 5.1/lib/opt/"
>>> 3. Build the project (with QtCreator)
>>>
>>> Everything must be ok, and you will now have libqsqlmysqld4.a
>>> and qsqlmysqld4.dll here
>>> %QTDIR%\plugins\sqldrivers
>>>
>>>
>>>
>>>
>>> El 2/08/2009, a las 05:33 p.m., Aditya Sharma escribió:
>>>
>>> But when I run mingw32-make, it gives me this error :
>>>
>>> mingw32-make -f Makefile.Debug all
>>> mingw32-make[1]: Entering directory
>>> `C:/qt/4.5/qt/src/plugins/sqldrivers/mysql'
>>> g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE
>>> -DQT_LARGEFILE_SUPPORT -
>>> DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN
>>> -DQT_SQL_LIB -
>>> DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore"
>>> -I"..\..\..\..\i
>>> nclude\QtSql" -I"..\..\..\..\include" -I"c:\mysql\include"
>>> -I"..\..\..\..\includ
>>> e\ActiveQt" -I"tmp\moc\debug_shared" -I"."
>>> -I"..\..\..\..\mkspecs\win32-g++" -o
>>> tmp\obj\debug_shared\main.o main.cpp
>>> g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE
>>> -DQT_LARGEFILE_SUPPORT -
>>> DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN
>>> -DQT_SQL_LIB -
>>> DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore"
>>> -I"..\..\..\..\i
>>> nclude\QtSql" -I"..\..\..\..\include" -I"c:\mysql\include"
>>> -I"..\..\..\..\includ
>>> e\ActiveQt" -I"tmp\moc\debug_shared" -I"."
>>> -I"..\..\..\..\mkspecs\win32-g++" -o
>>> tmp\obj\debug_shared\qsql_mysql.o
>>> ..\..\..\sql\drivers\mysql\qsql_mysql.cpp
>>> C:/qt/4.5/qt/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT
>>> -DQT_NO_CAST_TO_ASCII
>>> -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB
>>> -DQT_THR
>>> EAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql"
>>> -I"..\.
>>> .\..\..\include" -I"c:\mysql\include" -I"..\..\..\..\include\ActiveQt"
>>> -I"tmp\mo
>>> c\debug_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -D__GNUC__
>>> -DWIN32 ..\..
>>> \..\sql\drivers\mysql\qsql_mysql.h -o
>>> tmp\moc\debug_shared\moc_qsql_mysql.cpp
>>> g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE
>>> -DQT_LARGEFILE_SUPPORT -
>>> DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN
>>> -DQT_SQL_LIB -
>>> DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore"
>>> -I"..\..\..\..\i
>>> nclude\QtSql" -I"..\..\..\..\include" -I"c:\mysql\include"
>>> -I"..\..\..\..\includ
>>> e\ActiveQt" -I"tmp\moc\debug_shared" -I"."
>>> -I"..\..\..\..\mkspecs\win32-g++" -o
>>> tmp\obj\debug_shared\moc_qsql_mysql.o
>>> tmp\moc\debug_shared\moc_qsql_mysql.cpp
>>> windres -i qsqlmysqld_resource.rc -o
>>> tmp\obj\debug_shared\qsqlmysqld_resource_re
>>> s.o --include-dir=.
>>> g++ -enable-stdcall-fixup -Wl,-enable-auto-import
>>> -Wl,-enable-runtime-pseudo-rel
>>> oc -mthreads -Wl -shared
>>> -Wl,--out-implib,c:\qt\4.5\qt\plugins\sqldrivers\libqsq
>>> lmysqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll
>>> tmp/obj/debug_share
>>> d/main.o tmp/obj/debug_shared/qsql_mysql.o
>>> tmp/obj/debug_shared/moc_qsql_mysql.o
>>>   -L"c:\qt\4.5\qt\lib" -L"c:\qt\4.5\qt\lib"
>>> tmp\obj\debug_shared\qsqlmysqld_reso
>>> urce_res.o C:\mysql\MySQL Server <version>\lib\opt\libmysql.lib -lQtSqld4
>>> -lQtCo
>>> red4
>>> The system cannot find the file specified.
>>> mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll]
>>> Error 1
>>> mingw32-make[1]: Leaving directory
>>> `C:/qt/4.5/qt/src/plugins/sqldrivers/mysql'
>>> mingw32-make: *** [debug-all] Error 2
>>>
>>>
>>> Please help me, I am stuck.
>>>
>>> On Mon, Aug 3, 2009 at 4:57 AM, Aditya Sharma <88aditya88 at gmail.com>
>>> wrote:
>>>>
>>>>
>>>> When I try to run make, it says,
>>>> 'make' is not recognized as an internal or external command,
>>>> operable program or batch file.
>>>> similar is the case with nmake. what should i do?
>>>>
>>>> Aditya
>>>>
>>>>
>>>> On Mon, Aug 3, 2009 at 4:42 AM, Efrain Lopez <tecnomaya at cabsagt.com>
>>>> wrote:
>>>>>
>>>>> Perhaps if you tell the error message you get when following these
>>>>> instructions, you can get more help
>>>>>
>>>>> How to Build the QMYSQL Plugin on Windows
>>>>>
>>>>> You need to get the MySQL installation files. Run SETUP.EXE and choose
>>>>> "Custom Install". Install the "Libs & Include Files" Module. Build the
>>>>> plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
>>>>>
>>>>>  cd %QTDIR%\src\plugins\sqldrivers\mysql
>>>>>  qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server
>>>>> <version>\lib\opt\libmysql.lib" mysql.pro
>>>>>  nmake
>>>>>
>>>>> If you are not using a Microsoft compiler, replace nmake with make in
>>>>> the line above.
>>>>>
>>>>>
>>>>> El 2/08/2009, a las 04:26 p.m., Aditya Sharma escribió:
>>>>>
>>>>> I did what exactly said in different documentations, but it doesn't
>>>>> seem to work. I posted here because, I 've been trying for three days
>>>>> without success. Please help me through. The instruction written here,
>>>>> http://doc.trolltech.com/4.5/sql-driver.html#qmysql didn't work when i tried
>>>>> to run nmake, or make command. I did follow through what it was written in
>>>>> http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/
>>>>> as  well, but It didn't solve my problem.
>>>>>
>>>>> Please help.
>>>>>
>>>>> On Mon, Aug 3, 2009 at 12:40 AM, GreyGeek <GreyGeek at earthlink.net>
>>>>> wrote:
>>>>>>
>>>>>> Qt expects to see db drivers in a subdirectory called "sqldrivers"
>>>>>> under the one containing the executable.
>>>>>>
>>>>>> This means that if your installation of Qt hasn't compiled the mysql
>>>>>> driver you will have to.   Instructions are in the documentation.
>>>>>>
>>>>>> If they are already compiled they will be under
>>>>>> Qt\plugins\sqldrivers.   The dll's of the driver you need can be copied from
>>>>>> there to the subdir mentioned above.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Aditya Sharma wrote:
>>>>>>
>>>>>> i m learning qt. I am beginner programmer who knows C++. But as given
>>>>>> in tutorials I tried to run programs using mysql database. I have wamp
>>>>>> running in my windows xp box, so that means mysqld is also running. But when
>>>>>> i try to build the code in qt creator, it prompts, driver not installed or
>>>>>> something. Please help.
>>>>>>
>>>>>> aditya
>>>>>>
>>>>>> ________________________________
>>>>>> _______________________________________________
>>>>>> Qt-creator mailing list
>>>>>> Qt-creator at trolltech.com
>>>>>> http://lists.trolltech.com/mailman/listinfo/qt-creator
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ----
>>>>>> GreyGeek
>>>>>>
>>>>>> “They’ll get sort of addicted, and then we’ll somehow figure out how
>>>>>> to collect sometime in the next decade.”
>>>>>>
>>>>>> –Bill Gates
>>>>>>
>>>>>>
>>>>>> “Bill Gates looks at everything as something that should be his. He
>>>>>> acts in any way he can to make it his. It can be an idea, market share, or a
>>>>>> contract. There is not an ounce of conscientiousness or compassion in him.
>>>>>> The notion of fairness means nothing to him. The only thing he understands
>>>>>> is leverage.”
>>>>>>
>>>>>> –Philippe Kahn
>>>>>>
>>>>>> I don't think it's any coincidence that Microsoft achieved dominance
>>>>>> in the American market during the same period that bottled water became
>>>>>> omnipresent. In both instances, clever marketing convinced the general
>>>>>> public that something that was clean, safe and free was inferior to a
>>>>>> product encased in plastic.
>>>>>
>>>>> _______________________________________________
>>>>> Qt-interest mailing list
>>>>> Qt-interest at trolltech.com
>>>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Qt-interest mailing list
>>>>> Qt-interest at trolltech.com
>>>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>>
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list