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. SQLAPI++ undefined reference error
Forum Updated to NodeBB v4.3 + New Features

SQLAPI++ undefined reference error

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 6 Posters 1.8k Views 4 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.
  • P Offline
    P Offline
    PiotrWojtowicz
    wrote on 16 Feb 2020, 16:42 last edited by
    #1

    Hi I want to use 3rd part library which is SQLAPI++. I try to include all header files and libs but when i run "Add Library" and select all paths, it gives me error while compiling " error: undefined reference to `SAConnection::SAConnection()' ". I use MinGW compiler and here is how my .pro file looks like

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG += app_bundle
    CONFIG += qt
    
    SOURCES += \
            main.cpp
    
    
    
    
    INCLUDEPATH += C:\Users\Piotrek\Downloads\SQLAPI\include
    
    LIBS += -LC:\Users\Piotrek\Download\SQLAPI\lib
    
    win32:CONFIG(release, debug|release): LIBS += -llibsqlapi -llibsqlapid -llibsqlapiddll -llibsqlapidll -llibsqlapiu -llibsqlapiud -llibsqlapiuddll -llibsqlapiudll
    else:win32:CONFIG(debug, debug|release): LIBS += -llibsqlapi -llibsqlapid -llibsqlapiddll -llibsqlapidll -llibsqlapiu -llibsqlapiud -llibsqlapiuddll -llibsqlapiudll
    else:unix: LIBS += -llibsqlapi -llibsqlapid -llibsqlapiddll -llibsqlapidll -llibsqlapiu -llibsqlapiud -llibsqlapiuddll -llibsqlapiudll
    
    

    The SQLAPI++ comes with separated MinGW lib files (SQLAPI\lib and SQLAPI\MinGW_version\lib). First i tried to set the path to the SQLAPI\MinGW\libs folder but the problem still occured so i put them all into SQLAPI\lib directory and linked as you can see above, and still the same "undefined reference" error. The problem is i get this "undefined reference" all the time no matter what path i include, either SQLAPI\MinGW\lib or SQLAPI\lib . Maybe i should change kit form MinGW to Qt 5.12.1 MSVC 2017 but i have no idea how to connect msvc compiler to this kit ( i got Visual Studio Community 2019 ). My Qt Creator Version is 4.8.2 and QT 5.12.1 . I'm still learning so if there is something i understand incorrectly please explain it in your responses.

    Any answer would be appreciated.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 16 Feb 2020, 17:47 last edited by
      #2

      An include path is for headers, not for libraries. You have to define the lib to use in LIBS

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      P 1 Reply Last reply 16 Feb 2020, 19:57
      3
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 16 Feb 2020, 18:00 last edited by
        #3

        Hi
        Make sure your mingw compiler version matches the version used for the
        precompiled libs
        "The SQLAPI++ comes with separated MinGW lib files "

        And you cannot use visual studio with mingw libs.

        P 1 Reply Last reply 16 Feb 2020, 20:11
        3
        • C Christian Ehrlicher
          16 Feb 2020, 17:47

          An include path is for headers, not for libraries. You have to define the lib to use in LIBS

          P Offline
          P Offline
          PiotrWojtowicz
          wrote on 16 Feb 2020, 19:57 last edited by
          #4

          @Christian-Ehrlicher Thank you for replay. I think i did define LIBS += path. Please check my .pro file if it is defined properly.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 16 Feb 2020, 20:05 last edited by
            #5

            Hi,

            To add to my fellows, did you also check that the architecture of your library matches the one of your application ?

            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
            1
            • M mrjj
              16 Feb 2020, 18:00

              Hi
              Make sure your mingw compiler version matches the version used for the
              precompiled libs
              "The SQLAPI++ comes with separated MinGW lib files "

              And you cannot use visual studio with mingw libs.

              P Offline
              P Offline
              PiotrWojtowicz
              wrote on 16 Feb 2020, 20:11 last edited by
              #6

              @mrjj Thank you for your replay. I've checked my MinGW version and it's 7.3.0, in SQLAPI files there are only directory for MinGW_5.3, what should i do then ?

              ~"And you cannot use visual studio with mingw libs."
              I know, there are also folders for visual compiler, but i don't know how to connect QT 5.12.1 MSVC 2017 to a proper compiler. Can you please tell me how to do that or link a helpful article?
              Thank you.

              M 1 Reply Last reply 16 Feb 2020, 20:24
              0
              • P Offline
                P Offline
                PiotrWojtowicz
                wrote on 16 Feb 2020, 20:23 last edited by
                #7

                @SGaist Tanks for response. I'm sorry but i don't know what you mean
                ~"the architecture of your library matches the one of your application"
                How to check that out?

                1 Reply Last reply
                0
                • P PiotrWojtowicz
                  16 Feb 2020, 20:11

                  @mrjj Thank you for your replay. I've checked my MinGW version and it's 7.3.0, in SQLAPI files there are only directory for MinGW_5.3, what should i do then ?

                  ~"And you cannot use visual studio with mingw libs."
                  I know, there are also folders for visual compiler, but i don't know how to connect QT 5.12.1 MSVC 2017 to a proper compiler. Can you please tell me how to do that or link a helpful article?
                  Thank you.

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 16 Feb 2020, 20:24 last edited by mrjj
                  #8

                  Hi
                  Using visual studio with QT 5.12.1 MSVC 2017 requires you to download
                  the compiler from microsoft and install it. Make sure only to select the c++
                  component as else it installs a tons extra.
                  https://visualstudio.microsoft.com/downloads/

                  also make sure the architecture matches (as @SGaist says) , that is if 32 bit libs or 64 bit libs as you app need to be the same. (to load them)

                  Its not really clear from their site what visual studio version they support.
                  https://www.sqlapi.com/

                  Hmm it seems fairly old versions ??

                  MSVC++ Visual Studio 6, 2005 (x86 and x86-64), 2010 (x86 and x86-64), 2012 (x86 and x86-64), 2013 (x86 and x86-64), 2017 (x86 and x86-64)

                  MinGW g++ version 3.4, 4.8 (TDM x86 and x86-64), 4.9 (TDM x86 and x86-64), 5.1 (TDM x86 and x86-64)

                  Do you have a license ?
                  it says "SQLAPI++ ships with all the sources."
                  so you might end up in needing to compile them yourself as to match compiler
                  for lib and app and Qt.
                  https://www.sqlapi.com/ApiDoc/build-lib/

                  P 1 Reply Last reply 16 Feb 2020, 20:41
                  3
                  • M mrjj
                    16 Feb 2020, 20:24

                    Hi
                    Using visual studio with QT 5.12.1 MSVC 2017 requires you to download
                    the compiler from microsoft and install it. Make sure only to select the c++
                    component as else it installs a tons extra.
                    https://visualstudio.microsoft.com/downloads/

                    also make sure the architecture matches (as @SGaist says) , that is if 32 bit libs or 64 bit libs as you app need to be the same. (to load them)

                    Its not really clear from their site what visual studio version they support.
                    https://www.sqlapi.com/

                    Hmm it seems fairly old versions ??

                    MSVC++ Visual Studio 6, 2005 (x86 and x86-64), 2010 (x86 and x86-64), 2012 (x86 and x86-64), 2013 (x86 and x86-64), 2017 (x86 and x86-64)

                    MinGW g++ version 3.4, 4.8 (TDM x86 and x86-64), 4.9 (TDM x86 and x86-64), 5.1 (TDM x86 and x86-64)

                    Do you have a license ?
                    it says "SQLAPI++ ships with all the sources."
                    so you might end up in needing to compile them yourself as to match compiler
                    for lib and app and Qt.
                    https://www.sqlapi.com/ApiDoc/build-lib/

                    P Offline
                    P Offline
                    PiotrWojtowicz
                    wrote on 16 Feb 2020, 20:41 last edited by PiotrWojtowicz
                    #9

                    @mrjj Ok i will try to download this microsoft compiler.

                    I don't have license, i use trial version unfortunately i don't know how to "build" this library, can you please link some sources where i can learn how to do that?

                    I'm sorry if i'm being annoying but as i mentioned i'm still learning.
                    Thank you for your responses.

                    M 1 Reply Last reply 16 Feb 2020, 20:58
                    0
                    • P PiotrWojtowicz
                      16 Feb 2020, 20:41

                      @mrjj Ok i will try to download this microsoft compiler.

                      I don't have license, i use trial version unfortunately i don't know how to "build" this library, can you please link some sources where i can learn how to do that?

                      I'm sorry if i'm being annoying but as i mentioned i'm still learning.
                      Thank you for your responses.

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 16 Feb 2020, 20:58 last edited by mrjj
                      #10

                      @PiotrWojtowicz
                      Hi
                      The build instructions is here
                      https://www.sqlapi.com/ApiDoc/build-lib/
                      but you need the source.

                      You are not annoying at all. Just ask good/detailed questions and you get good
                      answers :)

                      I think using the trial version with visual studio can work
                      MSVC++ Visual Studio 6, 2005 (x86 and x86-64), 2010 (x86 and x86-64), 2012 (x86 and x86-64), 2013 (x86 and x86-64), 2017 (x86 and x86-64)

                      Note you need a MS account to get VS 2017.
                      I think 2019 also will work since they are said to be compatible.

                      make sure to only INSTALL the c++ part as else it will install GIGABYTES of
                      stuff.
                      alt text

                      1 Reply Last reply
                      3
                      • P Offline
                        P Offline
                        PiotrWojtowicz
                        wrote on 16 Feb 2020, 21:26 last edited by PiotrWojtowicz
                        #11

                        @mrjj Hi
                        First of all THANK YOU i will definitely give it a try and write soon if it works for me.

                        However you really interested me with build option.
                        I've checked the docs on SQLAPI++ out but still i don't know how to build that. Can you please give me a hand with that one?
                        How to add these build options to qmake or mingw32-make command ?

                        M aha_1980A 2 Replies Last reply 16 Feb 2020, 22:44
                        0
                        • P PiotrWojtowicz
                          16 Feb 2020, 21:26

                          @mrjj Hi
                          First of all THANK YOU i will definitely give it a try and write soon if it works for me.

                          However you really interested me with build option.
                          I've checked the docs on SQLAPI++ out but still i don't know how to build that. Can you please give me a hand with that one?
                          How to add these build options to qmake or mingw32-make command ?

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 16 Feb 2020, 22:44 last edited by mrjj
                          #12

                          Hi
                          The docs says
                          "You should use appropriate batch file located in the src subdirectory of SQLAPI++ distribution (sqlapi_msvc.bat, sqlapi_bcc.bat, sqlapi_mingw.bat, sqlapi_gcc, sqlapi_ss). These files also allow to modify SQLAPI++ build options."

                          So it sounds like you can just edit the right bat file (sqlapi_msvc.bat)
                          and you should be able to set/unset the options needed/wanted.

                          Also a note about the many databases supported.
                          I would assume you will need to download their client libraries
                          so you have their headers and such. Its unlikely the source contains all of these.

                          1 Reply Last reply
                          3
                          • P PiotrWojtowicz
                            16 Feb 2020, 21:26

                            @mrjj Hi
                            First of all THANK YOU i will definitely give it a try and write soon if it works for me.

                            However you really interested me with build option.
                            I've checked the docs on SQLAPI++ out but still i don't know how to build that. Can you please give me a hand with that one?
                            How to add these build options to qmake or mingw32-make command ?

                            aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on 17 Feb 2020, 06:11 last edited by
                            #13

                            @PiotrWojtowicz,

                            I just wanted to mention the obvious: Qt already contains SQL drivers for popular databases, which includes very well into other parts of Qt.

                            So whats your reason to use this SQLAPI?

                            Regards

                            Qt has to stay free or it will die.

                            1 Reply Last reply
                            3
                            • P Offline
                              P Offline
                              PiotrWojtowicz
                              wrote on 17 Feb 2020, 07:21 last edited by
                              #14

                              Ok guys thank you for help i eventually figure it out. Topic is closed.

                              JKSHJ 1 Reply Last reply 17 Feb 2020, 13:08
                              0
                              • P PiotrWojtowicz
                                17 Feb 2020, 07:21

                                Ok guys thank you for help i eventually figure it out. Topic is closed.

                                JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on 17 Feb 2020, 13:08 last edited by
                                #15

                                @PiotrWojtowicz said in SQLAPI++ undefined reference error:

                                Ok guys thank you for help i eventually figure it out.

                                Great!

                                Could you please share your solution in case it helps others?

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                P 1 Reply Last reply 17 Feb 2020, 14:29
                                3
                                • JKSHJ JKSH
                                  17 Feb 2020, 13:08

                                  @PiotrWojtowicz said in SQLAPI++ undefined reference error:

                                  Ok guys thank you for help i eventually figure it out.

                                  Great!

                                  Could you please share your solution in case it helps others?

                                  P Offline
                                  P Offline
                                  PiotrWojtowicz
                                  wrote on 17 Feb 2020, 14:29 last edited by
                                  #16

                                  @JKSH
                                  Yes i actually downloaded and installed MSVS c++ compiler then connected it to the MSVC 2017 Kit (its is compaible with 2019 microsoft sdk) and set the LIBS += path to msvc2019 lib directory. Thank you again for help!

                                  1 Reply Last reply
                                  3

                                  1/16

                                  16 Feb 2020, 16:42

                                  • Login

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