Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]mysql.pro build errors
Qt 6.11 is out! See what's new in the release blog

[SOLVED]mysql.pro build errors

Scheduled Pinned Locked Moved General and Desktop
18 Posts 5 Posters 8.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Are you trying to build the code from 5.2.1 with 5.1.1 ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • P Offline
      P Offline
      perry_coxer
      wrote on last edited by
      #5

      I'm sorry. My bad. I've forgotten that I have 5.1.1. Later I've got hold of 5.1.1 src and used them. mysql.pro:
      @TARGET = qsqlmysql

      SOURCES = main.cpp
      OTHER_FILES += mysql.json
      include(../../../sql/drivers/mysql/qsql_mysql.pri)

      PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
      include(../qsqldriverbase.pri)
      INCLUDEPATH += C:\MySQL_lib\include
      LIBS += C:\MySQL_lib\lib\libmysql.lib
      @
      Didn't edit anything else at all. Then, trying to rebuild, I get errors as follows:
      c:/qt/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
      collect2.exe: error: ld returned 1 exit status
      Thus, the lib cannot be found. And if I add not new paths, but default, how they were with the MySQL server from the start I get the same error.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        perry_coxer
        wrote on last edited by
        #6

        P.S. I've always had problems with linking with libs etc.)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #7

          Please use forward slashes for paths.

          Also try replacing your LIBS line with

          @LIBS += -LC:/MySQL_lib/lib@

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            perry_coxer
            wrote on last edited by
            #8

            Hi! Now it doesn't say it can't find a lib, but it obviously doesn't find it anyway. there are no "can't find" errors, but there are 107 "undefined reference to..." errors, all of them about some mysql functions. And all of them in qsql_mysql.cpp file(

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              What does "C:\MySQL_lib\lib" contain ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • P Offline
                P Offline
                perry_coxer
                wrote on last edited by
                #10

                I have removed and downloaded the most fresh MySQL. So now libs are located this way: C:\MySQL\MySQL_Server_5.5\lib and the mysql.pro looks like this:
                @TARGET = qsqlmysql

                SOURCES = main.cpp
                OTHER_FILES += mysql.json
                include(../../../sql/drivers/mysql/qsql_mysql.pri)

                PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
                include(../qsqldriverbase.pri)

                LIBS += -LC:/MySQL/MySQL_Server_5.5/lib
                INCLUDEPATH += C:/MySQL/MySQL_Server_5.5/include
                @
                Errors are absolutely the same. "C:/MySQL/MySQL_Server_5.5/lib" directory contains:
                debug (folder)
                plugin (folder)
                libmysql.dll
                libmysql.lib
                mysqlclient.lib

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  perry_coxer
                  wrote on last edited by
                  #11

                  May it be, that libmysql I have downloaded is, say, x64 or something of the sort, so that compiler just is not compatible with it?

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    clochydd
                    wrote on last edited by
                    #12

                    Hi, yes - if you try to use the 64-bit MYSQL with the mingw 32-Bit you won't succeed

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      perry_coxer
                      wrote on last edited by
                      #13

                      The thing is, that I don't really know how to find out)

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        clochydd
                        wrote on last edited by
                        #14

                        I suggest you have a look at this short step-by-step tutorial:
                        "Qt5 MYSQL":http://seppemagiels.com/blog/create-mysql-driver-qt5-windows

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          perry_coxer
                          wrote on last edited by
                          #15

                          Yes, thanks, I'm already reading and downloading mysql-5.6.16-win32.zip

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            PerryCoxer
                            wrote on last edited by
                            #16

                            Great thanks to everybody and especially to Samuel! Everything works!)

                            1 Reply Last reply
                            0
                            • C Offline
                              C Offline
                              clochydd
                              wrote on last edited by
                              #17

                              Hi, that's fine - good news!
                              Please mark your thread as [SOLVED] by editing the first post

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                marianexyx
                                wrote on last edited by
                                #18

                                What have you change, that you get rid off this error?

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved