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. QT6 Static Build error undefined reference to `SQLGetInfoW'
Forum Updated to NodeBB v4.3 + New Features

QT6 Static Build error undefined reference to `SQLGetInfoW'

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 921 Views 2 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.
  • faduF Offline
    faduF Offline
    fadu
    wrote on last edited by
    #1

    after finish building static and everything done
    when i add qmysql codes and try to run the program
    i see all this errors
    alt text
    this is compile static paramter

    cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DQT_BUILD_EXAMPLES=OFF -DINPUT_static_runtime=ON -DFEATURE_ltcg=OFF -DBUILD_qtwebengine=OFF -DOPENSSL_ROOT_DIR="C:\OpenSSL\openssl-1.1.1i\static\x64\debug" -DOPENSSL_USE_STATIC_LIBS=TRUE -DOPENSSL_MSVC_STATIC_RT=TRUE -DINPUT_sql_mysql=ON -DMySQL_INCLUDE_DIRS="C:\2\include" -DMySQL_LIBRARIES="C:\2\lib\mysqlclient.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\static" -G Ninja C:\Qt\6.1.2\Src
    

    also i add sql to my .pro file ```

    QT       += core gui sql
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      "When I add mysql codes", and a list of ODBC-related linker errors do not go together.

      I guess your static libraries have the Qt ODBC driver included and your application link options do not include the relevant Windows ODBC driver link libraries (odbc32.lib I think).

      1 Reply Last reply
      0
      • faduF Offline
        faduF Offline
        fadu
        wrote on last edited by fadu
        #3

        @ChrisW67
        i'm using qmysql only

        1 Reply Last reply
        0
        • faduF Offline
          faduF Offline
          fadu
          wrote on last edited by
          #4

          QSqlDatabase db ;
          db = QSqlDatabase::addDatabase("QMYSQL");
          db.setHostName("hhostip");
          db.setUserName("user");
          db.setPassword("pass");
          db.setDatabaseName("dbname");
          if(db.open())
          {
          ui->textEdit->setText("Ok");
          //db.close();
          }
          else {
          ui->textEdit->setText("No");
          db.close();
          }

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

            Hi,

            From the looks of it, you are not linking to the MySQL plugin exclusively.

            See here for more information about static plugins.

            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
            • faduF Offline
              faduF Offline
              fadu
              wrote on last edited by
              #6

              @SGaist can i edit configure (then rebuild it ) and link qmysql exclusivly becuase i didn't need any other sql type like odbc or sqlite

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

                Configure what ?

                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
                • faduF Offline
                  faduF Offline
                  fadu
                  wrote on last edited by fadu
                  #8

                  @SGaist
                  i mean the configure line of static build

                  cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DQT_BUILD_EXAMPLES=OFF -DINPUT_static_runtime=ON -DFEATURE_ltcg=OFF -DBUILD_qtwebengine=OFF -DOPENSSL_ROOT_DIR="C:\OpenSSL\openssl-1.1.1i\static\x64\debug" -DOPENSSL_USE_STATIC_LIBS=TRUE -DOPENSSL_MSVC_STATIC_RT=TRUE -DINPUT_sql_mysql=ON -DMySQL_INCLUDE_DIRS="C:\2\include" -DMySQL_LIBRARIES="C:\2\lib\mysqlclient.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\static" -G Ninja C:\Qt\6.1.2\Src
                  
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    I currently don't know if you can easily change that using cmake.

                    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
                    • faduF Offline
                      faduF Offline
                      fadu
                      wrote on last edited by
                      #10

                      i tried this code to skip odbc sql

                      cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DQT_BUILD_EXAMPLES=OFF -DINPUT_static_runtime=ON -DFEATURE_ltcg=OFF -DBUILD_qtwebengine=OFF -DINPUT_sql_odbc=OFF -DINPUT_sql_mysql=ON -DMySQL_INCLUDE_DIRS="C:\2\include" -DMySQL_LIBRARIES="C:\2\lib\mysqlclient.lib" -DMySQL_USE_STATIC_LIBS=TRUE -DCMAKE_INSTALL_PREFIX="C:\Qt\static" -G Ninja C:\Qt\6.1.2\Src
                      
                      

                      but doesn't work

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

                        And why not just modify the list of linked plugins like shown in the documentation I linked ?

                        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

                        • Login

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