anyone can tell me what's wrong in my prg ? It say's me : With this prg i would view a table from MySQL.
This is my code :
int main(void)
{
//QString mydb = "mydb";
QSqlDatabase database = QSqlDatabase::addDatabase("mydb");
//Setup the database
database.setDatabaseName( "mydb" );
database.setUserName( "root" );
database.setPassword( "testpw" );
if ( !database.open() )
qDebug("Couldn't open DB");
}
but i have the errors :
and i dont know why, its my first c++ / mysql prg and i think i have forget anything to download or to include .
/home/boldt/src/workspace/tester/Debug/../src/tester.cpp:33: undefined reference to
QSqlDatabase::defaultConnection' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:33: undefined reference to
QSqlDatabase::addDatabase(QString const&, QString const&)' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:36: undefined reference toQSqlDatabase::setDatabaseName(QString const&)' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:37: undefined reference to
QSqlDatabase::setUserName(QString const&)' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:38: undefined reference toQSqlDatabase::setPassword(QString const&)' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:40: undefined reference to
QSqlDatabase::open()' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:41: undefined reference toqDebug(char const*, ...)' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:41: undefined reference to
QSqlDatabase::~QSqlDatabase()' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:43: undefined reference toQSqlDatabase::~QSqlDatabase()' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:43: undefined reference to
QSqlDatabase::~QSqlDatabase()' /home/boldt/src/workspace/tester/Debug/../src/tester.cpp:41: undefined reference toQSqlDatabase::~QSqlDatabase()' ./src/tester.o: In function
QString::QString(char const*)': /usr/include/QtCore/qstring.h:419: undefined reference toQString::fromAscii_helper(char const*, int)' ./src/tester.o: In function
QString::QString(QLatin1String const&)': /usr/include/QtCore/qstring.h:694: undefined reference toQString::fromLatin1_helper(char const*, int)' ./src/tester.o: In function
QString::~QString()': /usr/include/QtCore/qstring.h:880: undefined reference to `QString::free(QString::Data*)'