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. undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?

undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?

Scheduled Pinned Locked Moved Solved General and Desktop
qt5c++11mongodbc++ qt
23 Posts 5 Posters 3.5k 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.
  • V Offline
    V Offline
    Vivek_A
    wrote on 18 Aug 2021, 12:58 last edited by
    #1

    hello iam solved my linking error of mongodb with qt creator , now i can include header file but when in command mongocxx::instance inst; error came

    E:/vivek/dw_tdoa_controller5/dw_tdoa_controller/main.cpp:37: undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
    

    my pro file

    win32:CONFIG(release, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dll
    else:win32:CONFIG(debug, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dll
    
    INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
    DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
    
    win32:CONFIG(release, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibbsoncxx.dll
    else:win32:CONFIG(debug, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibbsoncxx.dll
    
    INCLUDEPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
    DEPENDPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
    

    how to fix it

    vk

    J 1 Reply Last reply 18 Aug 2021, 13:03
    0
    • V Offline
      V Offline
      Vivek_A
      wrote on 24 Aug 2021, 06:27 last edited by
      #23

      my compiler is mingw32bit and mongocxx driver build in 64 bit . so thats make problem , i solved it by installing 64bit Qt.

      vk

      1 Reply Last reply
      0
      • V Vivek_A
        18 Aug 2021, 12:58

        hello iam solved my linking error of mongodb with qt creator , now i can include header file but when in command mongocxx::instance inst; error came

        E:/vivek/dw_tdoa_controller5/dw_tdoa_controller/main.cpp:37: undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
        

        my pro file

        win32:CONFIG(release, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dll
        else:win32:CONFIG(debug, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibmongocxx.dll
        
        INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
        DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
        
        win32:CONFIG(release, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibbsoncxx.dll
        else:win32:CONFIG(debug, debug|release): LIBS += -LC:/mongo-cxx-driver/lib/ -llibbsoncxx.dll
        
        INCLUDEPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
        DEPENDPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
        

        how to fix it

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 18 Aug 2021, 13:03 last edited by
        #2

        @Vivek_A Please take a look at https://doc.qt.io/qt-5/qmake-variable-reference.html#libs
        and fix your LIBS (hint: you need to add .lib not .dll).

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        V 1 Reply Last reply 18 Aug 2021, 13:11
        1
        • J jsulm
          18 Aug 2021, 13:03

          @Vivek_A Please take a look at https://doc.qt.io/qt-5/qmake-variable-reference.html#libs
          and fix your LIBS (hint: you need to add .lib not .dll).

          V Offline
          V Offline
          Vivek_A
          wrote on 18 Aug 2021, 13:11 last edited by
          #3

          @jsulm hi, its build using mingw64 so there is only .a file not .lib .
          full file is llibmongocxx.dll.a , this pro file command is generate by this IDE not manually written .

          vk

          J 1 Reply Last reply 18 Aug 2021, 13:13
          0
          • V Vivek_A
            18 Aug 2021, 13:11

            @jsulm hi, its build using mingw64 so there is only .a file not .lib .
            full file is llibmongocxx.dll.a , this pro file command is generate by this IDE not manually written .

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 18 Aug 2021, 13:13 last edited by
            #4

            @Vivek_A Please take a look at the link I gave you and compare with what you did...
            Should be

            LIBS += C:/mongo-cxx-driver/lib/llibbsoncxx.dll
            

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            V 1 Reply Last reply 19 Aug 2021, 07:04
            1
            • J jsulm
              18 Aug 2021, 13:13

              @Vivek_A Please take a look at the link I gave you and compare with what you did...
              Should be

              LIBS += C:/mongo-cxx-driver/lib/llibbsoncxx.dll
              
              V Offline
              V Offline
              Vivek_A
              wrote on 19 Aug 2021, 07:04 last edited by
              #5

              @jsulm

              LIBS += C:/mongo-cxx-driver/lib/llibbsoncxx.dll
              
              INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
              DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
              
              

              Output:

              g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory
              Makefile.Release:233: recipe for target 'release\RTLSController.exe' failed
              

              vk

              J J 2 Replies Last reply 19 Aug 2021, 07:07
              0
              • V Vivek_A
                19 Aug 2021, 07:04

                @jsulm

                LIBS += C:/mongo-cxx-driver/lib/llibbsoncxx.dll
                
                INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                
                

                Output:

                g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory
                Makefile.Release:233: recipe for target 'release\RTLSController.exe' failed
                
                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 19 Aug 2021, 07:07 last edited by
                #6

                @Vivek_A said in undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?:

                C:\mongo-cxx-driver\lib\llibbsoncxx.dll

                So, does this file exist? And I mean exact this path.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • V Vivek_A
                  19 Aug 2021, 07:04

                  @jsulm

                  LIBS += C:/mongo-cxx-driver/lib/llibbsoncxx.dll
                  
                  INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                  DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                  
                  

                  Output:

                  g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory
                  Makefile.Release:233: recipe for target 'release\RTLSController.exe' failed
                  
                  J Offline
                  J Offline
                  JonB
                  wrote on 19 Aug 2021, 07:09 last edited by JonB
                  #7

                  @Vivek_A said in undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?:

                  g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory

                  Originally you had -llibbsoncxx.dll. I am thinking the leading -l was an argument to the linker, followed by the DLL file name? Which would make it LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll (only one l)?

                  However, this is a separate matter from whether you should be specifying a .dll here, I thought you would need either a .lib (MSVC) or a .a (MinGW)...?

                  J 1 Reply Last reply 19 Aug 2021, 07:11
                  1
                  • J JonB
                    19 Aug 2021, 07:09

                    @Vivek_A said in undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?:

                    g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory

                    Originally you had -llibbsoncxx.dll. I am thinking the leading -l was an argument to the linker, followed by the DLL file name? Which would make it LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll (only one l)?

                    However, this is a separate matter from whether you should be specifying a .dll here, I thought you would need either a .lib (MSVC) or a .a (MinGW)...?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 19 Aug 2021, 07:11 last edited by
                    #8

                    @JonB I wanted the OP to find that out :-) This is something a developer should do first before asking in a forum. Really basic stuff.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    J 1 Reply Last reply 19 Aug 2021, 07:13
                    0
                    • J jsulm
                      19 Aug 2021, 07:11

                      @JonB I wanted the OP to find that out :-) This is something a developer should do first before asking in a forum. Really basic stuff.

                      J Offline
                      J Offline
                      JonB
                      wrote on 19 Aug 2021, 07:13 last edited by JonB
                      #9

                      @jsulm
                      Whoops, sorry for treading on your toes!

                      However I have amended my answer above since you saw it. Is one supposed to specify any DLL file in LIBS += ...?

                      J 1 Reply Last reply 19 Aug 2021, 07:14
                      0
                      • J JonB
                        19 Aug 2021, 07:13

                        @jsulm
                        Whoops, sorry for treading on your toes!

                        However I have amended my answer above since you saw it. Is one supposed to specify any DLL file in LIBS += ...?

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 19 Aug 2021, 07:14 last edited by
                        #10

                        @JonB It should be .lib, yes. But OP claims there is no .lib file, but I'm not a Windows developer.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        J V 2 Replies Last reply 19 Aug 2021, 07:23
                        0
                        • J jsulm
                          19 Aug 2021, 07:14

                          @JonB It should be .lib, yes. But OP claims there is no .lib file, but I'm not a Windows developer.

                          J Offline
                          J Offline
                          JonB
                          wrote on 19 Aug 2021, 07:23 last edited by
                          #11

                          @jsulm
                          A .lib will not do him, as he is using MinGW/gcc. I now see he wrote earlier:

                          full file is llibmongocxx.dll.a

                          That is an unusual naming convention! If that is really the case, and applies to llibbsoncxx.dll.a too, then it would indeed seem to be as he wrote. But the error message

                          g++: error: C:\mongo-cxx-driver\lib\llibbsoncxx.dll: No such file or directory
                          

                          shows what MinGW seems actually to be looking for, no mention of a .a suffix. So I'm not sure what is going on....

                          1 Reply Last reply
                          0
                          • J jsulm
                            19 Aug 2021, 07:14

                            @JonB It should be .lib, yes. But OP claims there is no .lib file, but I'm not a Windows developer.

                            V Offline
                            V Offline
                            Vivek_A
                            wrote on 19 Aug 2021, 07:23 last edited by Vivek_A
                            #12

                            @jsulm ok, i understand idid this

                            LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a
                            
                            INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                            DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                            

                            included but error that said first remains

                            ./release\main.o:main.cpp:(.text+0x1d): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                            ./release\main.o:main.cpp:(.text+0xee): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                            ./release\main.o:main.cpp:(.text+0x14e): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                            

                            if you dont know about windows side of this , then its ok.
                            @JonB i have doubt , the compiler is mingw 32 and i build the mongdb in mingw 64 is this makes any issues

                            vk

                            J J 2 Replies Last reply 19 Aug 2021, 07:25
                            0
                            • V Vivek_A
                              19 Aug 2021, 07:23

                              @jsulm ok, i understand idid this

                              LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a
                              
                              INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                              DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                              

                              included but error that said first remains

                              ./release\main.o:main.cpp:(.text+0x1d): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                              ./release\main.o:main.cpp:(.text+0xee): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                              ./release\main.o:main.cpp:(.text+0x14e): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                              

                              if you dont know about windows side of this , then its ok.
                              @JonB i have doubt , the compiler is mingw 32 and i build the mongdb in mingw 64 is this makes any issues

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 19 Aug 2021, 07:25 last edited by
                              #13

                              @Vivek_A You need to link at least one more lib containing the missing symbols (libmongocxx I guess).

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              2
                              • V Vivek_A
                                19 Aug 2021, 07:23

                                @jsulm ok, i understand idid this

                                LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a
                                
                                INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                

                                included but error that said first remains

                                ./release\main.o:main.cpp:(.text+0x1d): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                                ./release\main.o:main.cpp:(.text+0xee): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                ./release\main.o:main.cpp:(.text+0x14e): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                

                                if you dont know about windows side of this , then its ok.
                                @JonB i have doubt , the compiler is mingw 32 and i build the mongdb in mingw 64 is this makes any issues

                                J Offline
                                J Offline
                                JonB
                                wrote on 19 Aug 2021, 07:28 last edited by JonB
                                #14

                                @Vivek_A said in undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev in Qt?:

                                LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a

                                This looks much more reasonable than before!

                                Now as @jsulm says it looks like you need some further similars for other library files required to link successfully.

                                @JonB i have doubt , the compiler is mingw 32 and i build the mongdb in mingw 64 is this makes any issues

                                I am not sure what you are saying. It will not be possible to mix 64-bit-compiled code with 32-bit-compiled code in one executable. The compiler's bit-ness is not at issue, rather only whichever bit-ness it is generating code for.

                                Start by trying what @jsulm has pointed out, then deal with bit-ness if there is still an error.....

                                1 Reply Last reply
                                2
                                • V Offline
                                  V Offline
                                  Vivek_A
                                  wrote on 19 Aug 2021, 09:20 last edited by
                                  #15

                                  @JonB modified

                                  LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a
                                  LIBS += C:/mongo-cxx-driver/lib/libmongocxx.dll.a
                                  INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                  DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                  
                                  INCLUDEPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
                                  DEPENDPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
                                  

                                  clean & rebuilded
                                  Output:

                                  ./release\main.o:main.cpp:(.text+0x19): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                                  ./release\main.o:main.cpp:(.text+0x23): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                  collect2.exe: error: ld returned 1 exit status
                                  

                                  vk

                                  V 1 Reply Last reply 19 Aug 2021, 12:01
                                  0
                                  • V Vivek_A
                                    19 Aug 2021, 09:20

                                    @JonB modified

                                    LIBS += C:/mongo-cxx-driver/lib/libbsoncxx.dll.a
                                    LIBS += C:/mongo-cxx-driver/lib/libmongocxx.dll.a
                                    INCLUDEPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                    DEPENDPATH += C:/mongo-cxx-driver/include/mongocxx/v_noabi
                                    
                                    INCLUDEPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
                                    DEPENDPATH += C:/mongo-cxx-driver/include/bsoncxx/v_noabi
                                    

                                    clean & rebuilded
                                    Output:

                                    ./release\main.o:main.cpp:(.text+0x19): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                                    ./release\main.o:main.cpp:(.text+0x23): undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                    collect2.exe: error: ld returned 1 exit status
                                    
                                    V Offline
                                    V Offline
                                    Vivek_A
                                    wrote on 19 Aug 2021, 12:01 last edited by
                                    #16

                                    @Vivek_A anybody help...is that compiler problem

                                    ./debug\main.o: In function `Z5qMainiPPc':
                                    E:/vivek/dw_tdoa_controller7/dw_tdoa_controller/main.cpp:36: undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceC1Ev'
                                    E:/vivek/dw_tdoa_controller7/dw_tdoa_controller/main.cpp:36: undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                    E:/vivek/dw_tdoa_controller7/dw_tdoa_controller/main.cpp:36: undefined reference to `_imp___ZN8mongocxx7v_noabi8instanceD1Ev'
                                    collect2.exe: error: ld returned 1 exit status
                                    
                                    
                                    Makefile:36: recipe for target 'debug' failed
                                    mingw32-make[1]: *** [debug\RTLSController.exe] Error 1
                                    mingw32-make: *** [debug] Error 2
                                    17:25:51: The process "C:\Qt\Qt5.11.2\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
                                    Error while building/deploying project dw_controller (kit: Desktop Qt 5.11.2 MinGW 32bit)
                                    When executing step "Make"
                                    

                                    vk

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on 19 Aug 2021, 18:54 last edited by
                                      #17

                                      Try inverting the order of the libraries you are linking.

                                      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
                                      • V Offline
                                        V Offline
                                        Vivek_A
                                        wrote on 23 Aug 2021, 11:33 last edited by Vivek_A
                                        #18

                                        @SGaist tried , still same error , i think its not in the linking of lib, may be the installation or compiler problem... what u think???

                                        vk

                                        mrjjM 1 Reply Last reply 23 Aug 2021, 11:42
                                        0
                                        • V Vivek_A
                                          23 Aug 2021, 11:33

                                          @SGaist tried , still same error , i think its not in the linking of lib, may be the installation or compiler problem... what u think???

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 23 Aug 2021, 11:42 last edited by
                                          #19

                                          @Vivek_A

                                          Hi
                                          I saw this line
                                          building/deploying project dw_controller (kit: Desktop Qt 5.11.2 MinGW 32bit)

                                          but you said " its build using mingw64 "

                                          So are your 32 bit app trying to load 64 bit DLL ?

                                          V 1 Reply Last reply 23 Aug 2021, 12:40
                                          0
                                          • mrjjM mrjj
                                            23 Aug 2021, 11:42

                                            @Vivek_A

                                            Hi
                                            I saw this line
                                            building/deploying project dw_controller (kit: Desktop Qt 5.11.2 MinGW 32bit)

                                            but you said " its build using mingw64 "

                                            So are your 32 bit app trying to load 64 bit DLL ?

                                            V Offline
                                            V Offline
                                            Vivek_A
                                            wrote on 23 Aug 2021, 12:40 last edited by
                                            #20

                                            @mrjj hi sir, i build and installed mongocxx driver using ming64. The app running in Qt is Desktop Qt 5.11.2 MinGW 32bit, ie a mingw 32 bit compiler
                                            32cea6be-46de-4793-820b-4fc7a9d94cde-image.png

                                            vk

                                            1 Reply Last reply
                                            0

                                            4/23

                                            18 Aug 2021, 13:13

                                            topic:navigator.unread, 19
                                            • Login

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