Ubuntu Qt5.5 Mysql driver

现象:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins

原因:

Mysql数据库驱动未编译.


meegoyao@MeeGo:~/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so_bk 
	linux-vdso.so.1 =>  (0x00007ffc22da8000)
	libmysqlclient_r.so.16 => not found
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbde5720000)
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fbde54e0000)
	libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fbde52c0000)
	libssl.so.10 => not found
	libcrypto.so.10 => not found
	libQt5Sql.so.5 => /home/meegoyao/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007fbde5080000)
	libQt5Core.so.5 => /home/meegoyao/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007fbde4938000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbde4718000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbde4408000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbde4100000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbde3ee8000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbde3b20000)
	libicui18n.so.54 => /home/meegoyao/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.54 (0x00007fbde36b0000)
	libicuuc.so.54 => /home/meegoyao/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.54 (0x00007fbde3300000)
	libicudata.so.54 => /home/meegoyao/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.54 (0x00007fbde18d0000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbde16c8000)
	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fbde14c0000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbde12b8000)
	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbde0fa8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fbde5b80000)
	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fbde0d38000)

执行以下命令:

'/home/meegoyao/Qt5.5.0/5.5/gcc_64/bin/qmake'  "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro


出现

/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto



执行

sudo apt-get install libssl-dev

你可能感兴趣的:(开发环境)