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. Qt static with MYSQL

Qt static with MYSQL

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.1k Views
  • 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.
  • B Offline
    B Offline
    bu7ch3r
    wrote on 24 Nov 2011, 14:54 last edited by
    #1

    Hello I am trying to build qt staticaly in Windows using nmake. Entering in Visual Studio command prompt I am typing the following commands:

    vcvarsall.bat x86
    then
    switching to qt open source for windows msvc folder and type:
    configure -L C:\mysql\lib -I C:\mysql\include -release -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -static -qt-sql-mysql -platform win32-msvc2008

    My mysql version is 5.5 fresh downloaded from site and installed only the sources without the server.

    After configure is made I am typing nmake and the compiling starts.

    After some time I get unresolved externals. All pointing to myslq.

    My target is to have only one executable file with my application that includes all qt and mysql. What am I doing wrong?

    This is a part of error:

    Creating library ........\bin\assistant.lib and object ........\bin\ass
    istant.exp
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_num
    _rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult:
    :fetchLast(void)" (?fetchLast@QMYSQLResult@@MAE_NXZ)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_stm
    t_num_rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLRe
    sult::fetchLast(void)" (?fetchLast@QMYSQLResult@@MAE_NXZ)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_clo
    se@4 referenced in function "public: virtual void __thiscall QMYSQLDriver::close
    (void)" (?close@QMYSQLDriver@@UAEXXZ)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_thr
    ead_end@0 referenced in function "public: virtual void __thiscall QMYSQLDriver::
    close(void)" (?close@QMYSQLDriver@@UAEXXZ)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_cha
    racter_set_name@4 referenced in function "class QTextCodec * __cdecl codec(struc
    t st_mysql *)" (?codec@@YAPAVQTextCodec@@PAUst_mysql@@@Z)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_fet
    ch_lengths@4 referenced in function "protected: virtual class QVariant __thiscal
    l QMYSQLResult::data(int)" (?data@QMYSQLResult@@MAE?AVQVariant@@H@Z)
    QtSql.lib(qsql_mysql.obj) : error LNK2019: unresolved external symbol _mysql_ins
    ert_id@4 referenced in function "protected: virtual class QVariant __thiscall QM
    YSQLResult::lastInsertId(void)const " (?lastInsertId@QMYSQLResult@@MBE?AVQVarian
    t@@XZ)

    for(int i = 200; i > 0;)
    try
    {
    //do something
    }
    catch(...)
    {
    i--;//try again
    }

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blex
      wrote on 24 Nov 2011, 14:58 last edited by
      #2

      First check the MySQL client library documentation. Is it possible to link with it statically?


      Oleksiy Balabay

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bu7ch3r
        wrote on 24 Nov 2011, 15:04 last edited by
        #3

        There are 3 files in lib folder of mysql. libmysql.dll, libmysql.lib and mysqlclient.lib. I quess the last is for static build. The problem is that I have tryed to use explicit mysqlcliend.lib but getting other or the same link errors. I am sure that I am doing something wrong.
        Another question is regarding the qt static build. I am thinking to build only qt static and the try to link mysql lib. As far as I have read on the web you cannot add static link to mysql once you have build qt without that libs...

        for(int i = 200; i > 0;)
        try
        {
        //do something
        }
        catch(...)
        {
        i--;//try again
        }

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bu7ch3r
          wrote on 24 Nov 2011, 16:49 last edited by
          #4

          Another problem could be regarding the /MD and /MT switch... Right now I am trying to build qt using /MT on release

          for(int i = 200; i > 0;)
          try
          {
          //do something
          }
          catch(...)
          {
          i--;//try again
          }

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bu7ch3r
            wrote on 25 Nov 2011, 13:38 last edited by
            #5

            I have compiled qt in different ways entire night with no success. I guess I must use all qt army of dll for my project :)

            for(int i = 200; i > 0;)
            try
            {
            //do something
            }
            catch(...)
            {
            i--;//try again
            }

            1 Reply Last reply
            0

            1/5

            24 Nov 2011, 14:54

            • Login

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