PDA

View Full Version : Mysql plugin on Linux problem



.:saeed:.
20th January 2011, 16:11
Hello every one !
When i try to create mysql plugin with my ubuntu i get this error


/opt/qtsdk-2010.05/qt/src/plugins/sqldrivers/mysql$ sudo makeg++ -c -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include/mysql -I. -o main.o main.cpp
main.cpp:42: fatal error: qsqldriverplugin.h: No such file or directory
compilation terminated.
make: *** [main.o] Error 1

Help me please .
thanks

majorwoody
20th January 2011, 17:03
QT Docs say, that you need the sources for MySql


How to Build the QMYSQL 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 "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
make

After installing Qt, as described in the Installing Qt on X11 Platforms document, you also need to install the plugin in the standard location:

cd $QTDIR/src/plugins/sqldrivers/mysql
make install


I don't understand, why you build your plugin yourself, on my Ubuntu installation, the mysql-plugin is installed. (You should find it, when you have libqt4-sql-mysql installed)