Qt Centre Forum FAQ

Here you can find answers to questions about how the board works. Use the links or search box below to find your way around.

How to enable compiling MySQL support in Qt4?

Make sure you have development files for MySQL installed (You can try to locate mysql.h to verify this). If you don't have them, you have to install them before continuing. If you use package managers under Unix-like systems, the package is often called mysql-devel or mysql-dev. Under Windows you need to install MySQL with development files.

Pass option "-qt-sql-mysql" to configure – this will compile MySQL support directly into Qt.

Pass option "-plugin-sql-mysql" to configure – this will compile MySQL support as plugin.

If your MySQL header files and libraries are not in the default include/lib path of your system, remember to add "-I" and "-L" options (with proper arguments) to configure too.

If you don't have MySQL development files on your system or don't pass the -I and -L options if they are in a non-default place, Qt build process may abort later with message "MySQL support cannot be enabled due to functionality tests!"

Start compilation process using make, gmake or nmake (depending on your platform).

You can find an article with more detailed instructions in our wiki: Building the QMYSQL plugin on Windows using MinGW.

Do I have to recompile Qt from scratch to get MySQL support compiled as plugin?

No, you don't. After configure run the build process like this (remember to change working directory to the one containing configure (or configure.exe) first):

cd src
make sub-plugins

If you use nmake, mingw-make or gmake instead of make, just substitute it in the command above.

Compiler fails with message about failing functionality tests or complains it can't find mysql.h, but I have it in xxx. What to do?

Pass "-Ixxx" (where xxx is the path where mysql.h resides) to configure and restart the building process.

Example:

If you have "/usr/include/mysql/mysql.h", pass -I/usr/include/mysql to configure.

Compiler fails with message about failing functionality tests or complains it can't find -lmysql.lib (or -lmysqlclient), but I have it in xxx. What to do?

Pass "-Lxxx" (where xxx is the path where the "missing" file resides) to configure and restart the building process.

Example:

If your mysql.lib (or libmysqlclient) resides in "C:\mysql4.1\", pass "-LC:\mysql4.1\" to configure.

Search FAQ

Select this option if you would like your search to look in the text of FAQ items as well as their titles.

Select an option here to specify how you would like your search query to be treated. 'Any words' will return the most numerous but possibly least relevant results, while 'Complete phrase' will return only results that contain exactly what you are searching for.

Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.