I am really stuck right now, every time I try to compile my C ++ program, I get the output as follows:
release/dialog.o:dialog.cpp:(.text+0x9e): undefined reference to `mysql_init@4'
release/dialog.o:dialog.cpp:(.text+0xe1): undefined reference to `mysql_real_connect@32'
Scrolling all day to find workarounds, tutorials, whatever, reading tutorials, uninstalling mingw, mysql server, qt and reinstalling everything. I uninstalled qt again and built it from the source code ... converted libmysql.dll with 0.3 mingw-utils reimp.exe and dlltools.exe, etc. Nothing helped.
before using QT (notepad ++ and mingw only), I also had linker warnings telling me something about the stdcall-fixup-disable error, but compiled and processed programs.
later I again reinstalled everything that I think the current setup does not work better than the other setups before I do not even know that I created qt from the source. Is there a simple (regular, uncomplicated) way to get Qt, MinGW, C ++, MySQL5.5 to work together?
edit2: I fixed the code now that I got it to work, this is the smallest piece of code to start with:
#include <QtCore/QCoreApplication>
#include <QMYSQLDriver>
#include <qsqldatabase.h>
#include <QtSql>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
if(!db.open()){
}
return app.exec();
}
source
share