Results 1 to 4 of 4

Thread: Qt with MySql

  1. #1
    Join Date
    May 2009
    Posts
    17
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt with MySql

    Hello there,

    I need to use MySql in Qt, and it's all good to go, classes, methods... except for one little thing... My program can't connect to MySql.

    I have tried a lot of things, like following Qt doc, looking up in the internet, but nothing seems to work.
    (I've tried finding threads in QtCentre forum, but I think I didn't find specifically my problem.... I think.)

    Therefore, as a last resort, I'm humbly asking here if someone can point out what the heck I'm doing wrong...

    Like the Doc says, I use configure as:
    " configure -platform win32-g++ -static -release -qt-sql-sqlite -qt-sql-mysql -l mysql -I c:\mysql\include -L c:\mysql\lib\opt -fast "

    (i haven't tried -plugin-sql-mysql instead of -qt-sql-sqlite but i don't think that's the problem)

    and then run mingw32-make as the result of configure tells me to, after some 10 to 20 minutes i get :

    g++ -enable-stdcall-fixup - Wl, -enable-auto-import -Wl, -enable-runtime-pseudo-reloc - Wl, -subsytem,console -mthreads -Wl -o ..\..\bin\rcc.exe tmp/obj/release_shared/rcc.0 tmp/obj/release_shared/main.o -lmysql -Lc:\mysql\lib\opt -L C:/Qt/2010.02.1/qt/src/tools/
    bootstrap/release -lbootstrap -luser32 c:/qt/2010.02.1/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe
    e: cannot find -lmysql
    collect2: ld returned 1 exit status

    mingw32-make[4]: *** [..\..\..\bin\rcc.exe] Error 1
    mingw32-make[4]: Leaving directory C:/Qt/2010.02.1/qt/src/tools/rcc'
    mingw32-make[3]: *** [release] Error 2
    mingw32-make[3]: Leaving directory C:/Qt/2010.02.1/qt/src/tools/rcc'
    mingw32-make[2]: *** [all] Error 2
    mingw32-make[2]: Leaving directory C:/Qt/2010.02.1/qt/src/tools/rcc'
    mingw32-make[1]: *** [sub-rcc-make-default-ordered] Error 2
    mingw32-make[1]: Leaving directory C:/Qt/2010.02.1/qt
    mingw32-make: *** [all] Error 2

    Thank you for your time!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt with MySql

    Is there a mysql library (libmysql.lib?) in "c:\mysql\lib\opt"?

  3. The following user says thank you to ChrisW67 for this useful post:

    lyucs (17th July 2010)

  4. #3
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: Qt with MySql

    Have you read this ?

  5. The following user says thank you to saa7_go for this useful post:

    lyucs (17th July 2010)

  6. #4
    Join Date
    May 2009
    Posts
    17
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt with MySql

    Chris, yes, there is.
    saa, I used a diferent tutorial, but it is kinda the same. I'll try it anyways and edit this message with what I managed to do.

    Thank you both.

    EDIT:
    Yay, I finally managed to do it! Thank you!
    (in the end, I forgot using
    db.setUserName
    db.setHostName
    db.setPassword
    as well...)

    I'll go bang my head against the wall about 50 times and come back to thank you again.


    ...

    There, thank you.
    Last edited by lyucs; 17th July 2010 at 01:01.

Similar Threads

  1. Qt + Mysql on Mac OS X
    By P4ulo in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2012, 01:34
  2. I need MySQL driver for Qt 4.6, WindowsXP(32), MySQL 5.1
    By User_3 in forum Installation and Deployment
    Replies: 7
    Last Post: 15th October 2010, 16:19
  3. MySQL + QT4
    By TNT in forum Qt Programming
    Replies: 1
    Last Post: 5th January 2010, 15:35
  4. mysql 5.0.41 and qt 4
    By locus in forum Installation and Deployment
    Replies: 2
    Last Post: 20th June 2007, 08:08
  5. MYSQL 5 Table qt model as small Mysql admin
    By patrik08 in forum Qt-based Software
    Replies: 0
    Last Post: 1st May 2007, 10:43

Tags for this Thread

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.