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]Error while trying to compile the db2 drivers on Qt5

[Solved]Error while trying to compile the db2 drivers on Qt5

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.3k 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.
  • ealioneE Offline
    ealioneE Offline
    ealione
    wrote on last edited by ealione
    #1

    Hi all,

    I am trying for a while now to connect to a db2 database but with no success. I mainly followed "this":http://qt-project.org/doc/qt-4.8/sql-driver.html article on how to compile the drivers, but even though there should have been 3 simple commands I somehow managed to get errors without end.

    After Downloading the source of Qt 5.3.2 and opening the console (Qt5.3 for Desktop (MinGW 4.8 32bit))

    I typed

    @cd C:\Users\PC\Downloads\qt-everywhere-opensource-src-5.3.2\qtbase\src\plugins\sqldrivers\db2@

    to go to the required directory. Continuing I tried the command

    @qmake "INCLUDEPATH+=C:/Program Files (x86)/IBM/SQLLIB/include" "LIBS+=-LC:/Program Files (x86)/IBM/SQLLIB/lib/db2cli.lib"@

    I then downloaded VS community edition and tried running nmake, but it did not recognise the command if I changed the directory to where my makefile was so i tried typing

    @nmake C:\Users\PC\Downloads\qt-everywhere-opensource-src-5.3.2\qtbase\src\plugins\sqldrivers\db2\Makefile.Release@

    in VS2013 x64 CMD

    only to get the error "fatal error ui1073: Don't know how to make Makefile.Release".

    Does anyone know what am I doing wrong?

    thanks.

    1 Reply Last reply
    0
    • ealioneE Offline
      ealioneE Offline
      ealione
      wrote on last edited by
      #2

      Hi SGaist,
      Since I hope to be around here (probably not with this account) I would have to ask what is devnet? Is this how the Qt forums are called?

      Also why would I need another version of Qt, I just tried to use qmake on the source files, why would it care. Besides qmake worked, and produced some Makefiles (including a .Release, and .Debug) its just nmake that is not doing what its supposed to. I will try the whole process in another machine that does not have VS community edition and report back on what errors I might encounter.

      EDIT
      I did the whole process in my iOS machine, and managed to produce the libqsqlbd2.a and .prl files, but no matter where I try to copy them (e.g.. /Users/administrator/Qt/5.3/ios/plugins/sqldrivers or /Users/administrator/Qt/5.3/ios/lib) Qt won't recognise them.

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

        Yes, it's the old name of this forum

        On windows, you need to ensure that you are using a Qt version that matches the compiler you want to use.

        The iOS build is static, that requires a bit more handling to load 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
        • ealioneE Offline
          ealioneE Offline
          ealione
          wrote on last edited by
          #4

          I got Qt mingw and Qt vs2013, and tried to compile it with nmake and mingw-make respectively, without results, getting a "NMAKE 0x02 and 0x460 error" as you can see

          @C:\Program Files (x86)\Microsoft Visual Studio 12.0>cd C:\Users\PC\Downloads\qt-
          everywhere-opensource-src-5.3.2\qtbase\src\plugins\sqldrivers\db2

              "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe" -
          

          f Makefile.Release all

          Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
          Copyright (C) Microsoft Corporation. All rights reserved.

              link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /OUT:..\..\..\.
          

          .\plugins\sqldrivers\qsqldb2.dll @C:\Users\PC\AppData\Local\Temp\nmCB9D.tmp
          Creating library ........\plugins\sqldrivers\qsqldb2.lib and object ....
          ....\plugins\sqldrivers\qsqldb2.exp
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLAllocHandle@12 refe
          renced in function "public: virtual bool __thiscall QDB2Driver::open(class QStri
          ng const &,class QString const &,class QString const &,class QString const &,int
          ,class QString const &)" (?open@QDB2Driver@@UAE_NABVQString@@000H0@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLDisconnect@4 refere
          nced in function "public: virtual void __thiscall QDB2Driver::close(void)" (?clo
          se@QDB2Driver@@UAEXXZ)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLExecute@4 reference
          d in function "public: virtual bool __thiscall QDB2Result::exec(void)" (?exec@QD
          B2Result@@UAE_NXZ)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLFreeStmt@8 referenc
          ed in function "bool __cdecl qMakeStatement(class QDB2ResultPrivate *,bool,bool)
          " (?qMakeStatement@@YA_NPAVQDB2ResultPrivate@@_N1@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLCloseCursor@4 refer
          enced in function "protected: virtual void __thiscall QDB2Result::detachFromResu
          ltSet(void)" (?detachFromResultSet@QDB2Result@@MAEXXZ)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLGetData@24 referenc
          ed in function "protected: virtual class QVariant __thiscall QDB2Result::data(in
          t)" (?data@QDB2Result@@MAE?AVQVariant@@H@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLNumResultCols@8 ref
          erenced in function "public: virtual bool __thiscall QDB2Result::exec(void)" (?e
          xec@QDB2Result@@UAE_NXZ)

          ...

          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLTablesW@36 referenc
          ed in function "public: virtual class QStringList __thiscall QDB2Driver::tables(
          enum QSql::TableType)const " (?tables@QDB2Driver@@UBE?AVQStringList@@W4TableType
          @QSql@@@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLDriverConnectW@32 r
          eferenced in function "public: virtual bool __thiscall QDB2Driver::open(class QS
          tring const &,class QString const &,class QString const &,class QString const &,
          int,class QString const &)" (?open@QDB2Driver@@UAE_NABVQString@@000H0@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLSetStmtAttrW@16 ref
          erenced in function "public: virtual class QSqlIndex __thiscall QDB2Driver::prim
          aryIndex(class QString const &)const " (?primaryIndex@QDB2Driver@@UBE?AVQSqlInde
          x@@ABVQString@@@Z)
          qsql_db2.obj : error LNK2019: unresolved external symbol _SQLPrimaryKeysW@28 ref
          erenced in function "public: virtual class QSqlIndex __thiscall QDB2Driver::prim
          aryIndex(class QString const &)const " (?primaryIndex@QDB2Driver@@UBE?AVQSqlInde
          x@@ABVQString@@@Z)
          ........\plugins\sqldrivers\qsqldb2.dll : fatal error LNK1120: 23 unresolved
          externals
          NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0
          \VC\BIN\link.EXE"' : return code '0x460'
          Stop.
          NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0
          \VC\BIN\nmake.exe"' : return code '0x2'
          Stop.

          C:\Users\PC\Downloads\qt-everywhere-opensource-src-5.3.2\qtbase\src\plugins\sqld
          rivers\db2>@

          Now be honest, is this really so simple as Qt documentation claims it to be and I am really bad at this, or its actually not that simple, because as you are saying in iOS there is some other procedures I have to do, and on windows outputs errors even though I reinstalled VS and I have the correct Qt versions.

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

            Windows is not the most programmer friendly OS. Looks like you are not linking to all needed libraries. Did you change anything to your qmake arguments ?

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

              No the command is exactly as I showed it in my first post. In any case I got tired trying to compile them on windows, is there a tutorial on using the static ones that I made on iOS, because I could not find one in this site, since I already have them and all.

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

                I knew I missed something:
                @
                qmake "INCLUDEPATH+=C:/Program Files (x86)/IBM/SQLLIB/include" "LIBS+=-LC:/Program Files (x86)/IBM/SQLLIB/lib/db2cli.lib"
                @

                -L is for giving a path and -l is for the library

                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
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Don't worry, it happens to all of us

                  Since you have it building now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                  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