PDA

View Full Version : undefined references to mysql



Ahas
19th May 2011, 16:02
Hi,
When compiling Qt static on windows 7 with mysql I get undefined refrences errors like:


c:\Qt\4.7.3-static\lib/libQtSql.a(qsql_mysql.o):qsql_mysql.cpp:(.text+0x4 7ae): undefined reference to `mysql_stmt_attr_set@12'

I found out that "mysql_stmt_attr_set" is a function of mysql.

So in the file qsql_mysql.cpp there are a lot of mysql-functions used that all give an undefined reference error.

I configured Qt like this:


configure -release -opensource -static -L C:\mysql\lib\opt -L C:\mysql\lib -I C:\mysql\include -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -webkit -qt-sql-mysql -platform win32-g++ -qt-zlib -qt-gif -qt-libpng -qt-libtiff -qt-libjpeg


C:\mysql\lib\opt, C:\mysql\lib and C:\mysql\include is where all the mysql libs and includes are.

Is there something wrong with the configure statement? Does it not find all the neccessary mysql includes or libs?

Can somebody please help, or point me in the right direction?
Thanks.

schnitzel
19th May 2011, 20:00
it may help if you show the output from the build process and the contents of your .pro file.

I have never tried to build static apps (licensing implications). Try googling "mysql static compile Qt".

Ahas
23rd May 2011, 19:38
I'm not compiling a program, I'm trying to compile/install Qt.

I get the undefined reference errors after mingw32-make.

I searched all the guides to install Qt with mysql static and followed all instruction I could find. I keep getting the undefined reference errors.

The errors are all with respect to mysql. So I think while compiling Qt it doesn't use the libs and includes from mysql, it can't find them or the necessary ones aren't there. But I did instaal mysql with libs and includes.

I have no idea what can be wrong here.

Please help if you have an idea of what might be going wrong.
Thanks

schnitzel
25th May 2011, 18:02
did you build the static mysql driver plugin?

perhaps this will be useful:
http://www.qtcentre.org/threads/18153-How-to-use-static-mysql-plugin