Results 1 to 20 of 29

Thread: QMYSQL Driver (undefined symbol: mysql_server_init)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    What i mean is this /usr/lib/qt4/plugins/sqldrivers/mysql/mysql.pro. If mysql.pro doesn't exist, i assume you install Qt from your package management. Maybe you can search Qt MySQL plugin package using synaptic or something like that.
    Last edited by saa7_go; 24th July 2010 at 21:05. Reason: updated contents

  2. #2
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    yes, I was install Qt from synaptic install manager

    I install all package but mysql.pro is not present

    and I have qt4 and qt3, can this make problems

  3. #3
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by miroslavgojic View Post
    I install all package but mysql.pro is not present.
    and I have qt4 and qt3, can this make problems.
    I'm not sure. But, have you search Qt4 MySQL plugin using synaptic?

  4. #4
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I have look in synaptic and I have Qt mysql driver, it is installed at my Ubuntu

    Qt4 Mysql database driver - this is name of synaptic package

  5. #5
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    So, you don't need to rebuilt Qt MySQL driver. Try to create simple application using MySQL driver.
    Last edited by saa7_go; 24th July 2010 at 21:55. Reason: updated contents

  6. #6
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I try to create simply application Qt and Mysql
    and there I find some unexpected problems.

    I make one project on C not C++, and it work, but this is not from QT, simply C code from gedit and gcc

    I have one project in QT

    one file is

    connector.h
    Qt Code:
    1. #ifndef CONNECTOR_H
    2. #define CONNECTOR_H
    3. #include <QSqlDatabase>
    4. #include <QMessageBox>
    5.  
    6. bool createConnection()
    7. {
    8. if (QSqlDatabase::isDriverAvailable("QMYSQL"))
    9. {
    10. QSqlDatabase db = QSqlDatabase.addDatabase("QMYSQL");
    11. db.setHostName("localhost");
    12. db.setDatabaseName("test");
    13. db.setUserName("user");
    14. db.setPassword("pass");
    15.  
    16. if (!db.open())
    17. {
    18. m.setText("Greska I");
    19. m.exec();
    20. return false;
    21. }
    22. else
    23. {
    24. return true;
    25. }
    26. }
    27. else
    28. {
    29. m.setText("Nema drajver za DB");
    30. m.exec();
    31. return false;
    32. }
    33.  
    34. }
    35.  
    36. #endif // CONNECTOR_H
    To copy to clipboard, switch view to plain text mode 

    and main.cpp

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3. #include "connector.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication a(argc, argv);
    8.  
    9. if(!createConnection())
    10. return 1;
    11.  
    12. MainWindow w;
    13. w.show();
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    and this project not work at QT

  7. #7
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Are there any error/warning messages from your application?

  8. #8
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I have this errors:

    Qt Code:
    1. /home/miroslav/dekis/Dekis/main.cpp:3: In file included from main.cpp:3:
    2. /home/miroslav/dekis/Dekis/connector.h:3: error: QSqlDatabase: No such file or directory
    3. /home/miroslav/dekis/Dekis/main.cpp:3: In file included from main.cpp:3:
    4. /home/miroslav/dekis/Dekis/connector.h:9: error: ‘QSqlDatabase’ has not been declared
    5. /home/miroslav/dekis/Dekis/connector.h:11: error: ‘QSqlDatabase’ was not declared in this scope
    6. /home/miroslav/dekis/Dekis/connector.h:11: error: expected ‘;’ before ‘db’
    7. /home/miroslav/dekis/Dekis/connector.h:12: error: ‘db’ was not declared in this scope
    8. /home/miroslav/dekis/Dekis/main.cpp:12: error: expected ‘;’ before ‘w’
    9. /home/miroslav/dekis/Dekis/main.cpp:13: error: ‘w’ was not declared in this scope
    10. /home/miroslav/dekis/Dekis/main.cpp:12: error: ‘MainWindow’ was not declared in this scope
    11. /home/miroslav/dekis/Dekis/main.cpp:12: error: expected ‘;’ before ‘w’
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Can you post/attach your mainwindow.h and project file (*.pro)?

    It looks like you don't add sql module in your project file.

  10. #10
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    mainwindow.h

    Qt Code:
    1. /****************************************************************************
    2. ** Form interface generated from reading ui file 'mainwindow.ui'
    3. **
    4. ** Created: Sat Jul 24 19:27:05 2010
    5. **
    6. ** WARNING! All changes made in this file will be lost!
    7. ****************************************************************************/
    To copy to clipboard, switch view to plain text mode 

    Dekis.pro
    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Tue Jul 20 19:42:45 2010
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET =
    7. DEPENDPATH += .
    8. INCLUDEPATH += .
    9.  
    10. # Input
    11. HEADERS += connector.h mainwindow.h
    12. FORMS += mainwindow.ui
    13. SOURCES += main.cpp mainwindow.cpp
    To copy to clipboard, switch view to plain text mode 

  11. #11
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    Quote Originally Posted by miroslavgojic View Post
    mainwindow.h

    Qt Code:
    1. /****************************************************************************
    2. ** Form interface generated from reading ui file 'mainwindow.ui'
    3. **
    4. ** Created: Sat Jul 24 19:27:05 2010
    5. **
    6. ** WARNING! All changes made in this file will be lost!
    7. ****************************************************************************/
    To copy to clipboard, switch view to plain text mode 
    Where is your MainWindow class declaration?

    Quote Originally Posted by miroslavgojic View Post
    Dekis.pro
    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Tue Jul 20 19:42:45 2010
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET =
    7. DEPENDPATH += .
    8. INCLUDEPATH += .
    9.  
    10. # Input
    11. HEADERS += connector.h mainwindow.h
    12. FORMS += mainwindow.ui
    13. SOURCES += main.cpp mainwindow.cpp
    To copy to clipboard, switch view to plain text mode 
    Add the the following line in Dekis.pro

    Qt Code:
    1. QT += sql
    To copy to clipboard, switch view to plain text mode 

  12. #12
    Join Date
    Jul 2010
    Location
    Serbia, Belgrade
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: QMYSQL Driver (undefined symbol: mysql_server_init)

    I was not make changes in MainWindow class declaration.

Similar Threads

  1. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 16:00
  2. Replies: 1
    Last Post: 22nd June 2010, 20:56
  3. QtPlugin and undefined symbol
    By Mikoskay in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2010, 13:04
  4. QMYSQL driver
    By pcaeiro in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2009, 15:35
  5. undefined symbol in library
    By quickNitin in forum General Programming
    Replies: 1
    Last Post: 16th November 2006, 11:50

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
  •  
Qt is a trademark of The Qt Company.