Results 1 to 11 of 11

Thread: Qt 4.1 OS on Windows & mysql

  1. #1
    Join Date
    Jan 2006
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Qt 4.1 OS on Windows & mysql

    Hi there,
    I have downloaded the binary installer for QT 4.1.0 Open Source version, with the MinGW compiler, and installed it into c:\qt\4.1.0

    I have mysql 4.1 running on my WinXP pc, and I have downloaded the header files and put them into c:\mysql

    My issue is that it appears that I have to compile the mysql driver, according to these trolltech.com docs

    Try as I might, when following these steps exactly, all I get are "undefined reference" errors when running make. EG:
    Qt Code:
    1. tmp\obj\release_shared\qsql_mysql.o(.text+0x6c7):qsql_mysql.cpp: undefined reference to `mysql_stmt_error@4'
    2. tmp\obj\release_shared\qsql_mysql.o(.text+0x6db):qsql_mysql.cpp: undefined reference to `mysql_stmt_errno@4'
    To copy to clipboard, switch view to plain text mode 

    I should point out that I can compile a basic "hello world" app using QT just fine, so I'm reasonably sure that QT and MinGW are installed and working ok.

    Can someone help me to get the mysql driver working please?

    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt 4.1 OS on Windows & mysql

    Read this and then try:
    Building the Plugins Manually QMYSQL for MySQL 3.x and MySQL 4.x

    General Information

    MySQL 3.x doesn't support SQL transactions by default, although there are some backends which offer this functionality. Recent versions of the MySQL client libraries (>3.23.34) allow you to use transactions on those modified servers.
    If you have a recent client library and connect to a transaction-enabled MySQL server, a call to the QSqlDriver::hasFeature( QSqlDriver::Transactions ) function returns true and SQL transactions can be used. If the plugin is compiled against MySQL 4.x client libraries, transactions are enabled by default. You can find information about MySQL on http://www.mysql.com

    How to Build the Plugin on Unix and Mac OS X
    You need the MySQL header files and as well as the shared library libmysqlclient.so. Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel".
    Tell qmake where to find the MySQL header files and shared libraries (here it is assumed that MySQL is installed in /usr/local) and run make:
    cd $QTDIR/src/plugins/sqldrivers/mysql
    qmake -o Makefile "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient" mysql.pro
    make

    How to Build the 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 -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
    nmakeIf you are not using a Microsoft compiler, replace nmake with make in the line above.
    Qt 5.3 Opensource & Creator 3.1.2

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4.1 OS on Windows & mysql

    Quote Originally Posted by neeko
    Hi there,
    I have downloaded the binary installer for QT 4.1.0 Open Source version, with the MinGW compiler, and installed it into c:\qt\4.1.0

    I have mysql 4.1 running on my WinXP pc, and I have downloaded the header files and put them into c:\mysql
    Are you sure you have header files from mysql 4.1 and not 5.0? I don't remember seeing "mysql_stmt_errno" in MySql 4 API.
    Last edited by wysota; 5th January 2006 at 10:25.

  4. #4
    Join Date
    Jan 2006
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.1 OS on Windows & mysql

    Wysota: I have been trying both sets, so maybe I've gotten them mixed up. I'll delete the directory, reinstall them and try again.

    Markosan: This looks similar to the instructions on Trolltech's site as in my first post, that error during Make. I'll reinstall the headers first then try again.

    Thanks
    Last edited by neeko; 5th January 2006 at 20:57.

  5. #5
    Join Date
    Jan 2006
    Location
    Iasi, Romania
    Posts
    10
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.1 OS on Windows & mysql

    Not sure if this link will help but it worked for me (Qt 4.0.0, MySQL 4.1.11, WinXP pro)

  6. #6
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt 4.1 OS on Windows & mysql

    I had to manualy edit the makefile for sql and then worked, because, in my case, make could not find library files.
    Qt 5.3 Opensource & Creator 3.1.2

  7. #7
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qt 4.1 OS on Windows & mysql

    How did you have to edit Makefile?

    Are you using the MinGW version of MySQL? See for example:
    QT 4.1 Windows and MySQL

  8. #8
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.1 OS on Windows & mysql

    Quote Originally Posted by neeko
    Wysota: I have been trying both sets, so maybe I've gotten them mixed up. I'll delete the directory, reinstall them and try again.

    Markosan: This looks similar to the instructions on Trolltech's site as in my first post, that error during Make. I'll reinstall the headers first then try again.

    Thanks

    This worked for me too...


    1) Creating the MySQL client library.
    - - - - - - - - - - - - - - - - - - -

    Unfortunatly, the client libraries (libmysql.ddl and libmysql.lib)
    shipped with MySQL are compiled with the M$ compiler and are causing
    problems with try to link them with the MinGW compiler. Therefore,
    we first need to create a MinGW compatible library out of libmysql.dll.
    This can be done by taking the following steps:

    1. cd c:\mysql\lib\opt (c:\mysql is where our MySQL is installed)
    2. reimp -d libmysql.lib (reimp comes with MinGW utilities)
    3. dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib

    libmysql.a

    Now we have the MinGW compatible library called libmysql.a
    If there weren't noobs there would be no experts

  9. #9
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt 4.1 OS on Windows & mysql

    Quote Originally Posted by dimitri
    How did you have to edit Makefile?

    Are you using the MinGW version of MySQL? See for example:
    QT 4.1 Windows and MySQL
    I manually added path to lib files, since the make could not find them. I use Qt 4.0.1 Commercial under WinXP Pro.
    Qt 5.3 Opensource & Creator 3.1.2

  10. #10
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qt 4.1 OS on Windows & mysql

    Which MySQL are you using? Obe built for MinGW? Where did you get it from?

  11. #11
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.1 OS on Windows & mysql

    See this thread:
    http://lists.trolltech.com/qt-intere...ad00014-0.html

    that worked for me
    (Win2k, Qt 4.1 GPL, MinGW, MySQL4 default win32 build (not self-compiled))

Similar Threads

  1. Embedded Mysql Windows Qt4.1
    By benguela in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2007, 00:13
  2. Qt in windows and mysql !!!
    By probine in forum Installation and Deployment
    Replies: 13
    Last Post: 9th December 2006, 07:42
  3. Connection to MySQL - windows
    By Peter34 in forum Qt Programming
    Replies: 18
    Last Post: 30th October 2006, 18:54
  4. Deploying with MySQL support under Windows
    By KShots in forum Installation and Deployment
    Replies: 1
    Last Post: 12th October 2006, 09:19
  5. Problems building mysql plugin for Qt 4.1.2 on windows XP
    By Philip_Anselmo in forum Installation and Deployment
    Replies: 3
    Last Post: 17th May 2006, 15:38

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.