Results 1 to 2 of 2

Thread: undefined reference to QMYSQLDriver

  1. #1
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default undefined reference to QMYSQLDriver

    I want to create a connection to an existent MySQL Server. I have already tested if have support and I have. Everything is in the right folder. And in case it’s important, I’m using the Qt Creator with Qt 4.7 on Ubuntu. I really hope someone here can help me.
    Thank you in anticipation!

    Here’s my code:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql/QSqlDatabase>
    3. #include <QtSql/QMYSQLDriver>
    4. #include <QtSql/QtSql>
    5. #include <QMessageBox>
    6.  
    7. bool createConnection(){ QSqlDatabase db = QSqlDatabase::addDatabase(“QMYSQL”);
    8. db.setHostName(“edu.uni-ulm.de”);
    9. db.setDatabaseName(“config”);
    10. db.setPort(1234);
    11. db.setUserName(“gbatstone”);
    12. db.setPassword(“Hiddsg44”);
    13. if (!db.open()){
    14. QMessageBox::critical(0, QObject::tr(“Database Error”), db.lastError().text());
    15. return false;
    16. }
    17. return true; }
    18.  
    19. int main(int argc, char *argv[])
    20. { QApplication a(argc, argv);
    21. if (!createConnection()) return 1;
    22. return a.exec();
    23. }
    To copy to clipboard, switch view to plain text mode 

    The .pro file:
    Qt Code:
    1. QT += core gui
    2. QT += sql
    3. TARGET = Test
    4. TEMPLATE = app
    5. SOURCES += main.cpp
    6. HEADERS += ../../../../../../usr/include/qt4/QtSql/qsql_mysql.h \ ../../../../../../usr/include/mysql/mysql.h
    7. INCLUDEPATH += “/usr/include/mysql/” \ “/usr/include/qt4/QtSql/”
    8. LIBS+=”-L/usr/lib/mysql”
    To copy to clipboard, switch view to plain text mode 
    And the complete error message:
    /home/melanie/Desktop/Workspace/Qt Test/Test-build-desktop/moc_qsql_mysql.cpp:73: error: undefined reference to `QMYSQLDriver::isIdentifierEscapedImplementation(Q String const&, QSqlDriver::IdentifierType) const’

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: undefined reference to QMYSQLDriver

    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 16:45
  2. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 14:45
  3. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 09:34
  4. Undefined Reference To...
    By ManuMies in forum Qt Programming
    Replies: 6
    Last Post: 10th February 2009, 13:14
  5. Undefined reference
    By Salazaar in forum Newbie
    Replies: 12
    Last Post: 23rd May 2007, 11:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.