我真的很坚持,现在,每次我尝试编译我的C++ PROGRAMM我得到的输出是这样的:QT:未定义的引用“mysql_something @ NR”
release/dialog.o:dialog.cpp:(.text+0x9e): undefined reference to `[email protected]'
release/dialog.o:dialog.cpp:(.text+0xe1): undefined reference to `[email protected]'
浏览整天找解决方法,教程,无论如何,阅读教程,卸载mingw,MySQL服务器,QT和再次安装一切。我再次删除qt并从源代码构建它...用0.3 mingw-utils reimp.exe和dlltools.exe等转换libmysql.dll,没有任何帮助。在使用QT(只是记事本++和mingw)之前,我也有链接器警告,并告诉我一些关于stdcall-fixup-disable的内容,但程序编译和工作。
后来我会再次重新安装一切我认为,目前的设置没有比其他安装更好的工作之前,我甚至不知道我从源头上构建qt。 是否有任何简单(普通,简单)的方式来获得Qt,MinGW,C++,MySQL5.5一起工作?
EDIT2:我现在纠正的代码,我得到它的工作,这是一些最起码的代码片段开始说起:
#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");
// insert other connection options here
if(!db.open()){
// dp not open, add some debug text and stuff, exit or retry
}
//db should be open at this place, add code here
return app.exec();
}
作为提示,您可以在Google上搜索此错误消息,删除您的特定关键字,输入查询:* undefined reference to mysql_init *。 – vz0 2011-01-25 19:24:15
好吧,我想我现在会接受一个答案,因为我的问题现在不再是一个未链接的库,但运行时错误 – Baarn 2011-01-29 15:31:22