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 Creator error “No such file or directory” when using boost in mongocxx
Forum Updated to NodeBB v4.3 + New Features

Qt Creator error “No such file or directory” when using boost in mongocxx

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 7 Posters 3.4k 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.
  • S Offline
    S Offline
    SimonR
    wrote on last edited by
    #3

    I've changed my .pro file to this now, but I still get the same error.

    QT += quick
    
    CONFIG += c++17
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    SOURCES += \
            main.cpp \
            signIn.cpp \
            signUp.cpp
    
    INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \ C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \ D:/boost_1_72_0
    
    RESOURCES += qml.qrc
    
    TRANSLATIONS += \
        LogIn_en_CA.ts
    
    QML_IMPORT_PATH =
    
    QML_DESIGNER_IMPORT_PATH =
    
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    HEADERS += \
        signIn.h \
        signUp.h
    
    LIBS += -LC:/mongo-cxx-driver-3.4.1/lib -lbsoncxx \
            -LC:/mongo-cxx-driver-3.4.1/lib -lmongocxx
    
    B 1 Reply Last reply
    0
    • S SimonR

      I've changed my .pro file to this now, but I still get the same error.

      QT += quick
      
      CONFIG += c++17
      
      DEFINES += QT_DEPRECATED_WARNINGS
      
      SOURCES += \
              main.cpp \
              signIn.cpp \
              signUp.cpp
      
      INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \ C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \ D:/boost_1_72_0
      
      RESOURCES += qml.qrc
      
      TRANSLATIONS += \
          LogIn_en_CA.ts
      
      QML_IMPORT_PATH =
      
      QML_DESIGNER_IMPORT_PATH =
      
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      HEADERS += \
          signIn.h \
          signUp.h
      
      LIBS += -LC:/mongo-cxx-driver-3.4.1/lib -lbsoncxx \
              -LC:/mongo-cxx-driver-3.4.1/lib -lmongocxx
      
      B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #4
      This post is deleted!
      1 Reply Last reply
      0
      • S SimonR

        I'm writing an application in Qt and want to add the mongocxx driver to access data in my db. I've added the libs and header files using LIBS and INCLUDEPATH. Now, mongocxx also requires boost. But now I get the error: C:\mongo-cxx-driver-3.4.1\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp:40: error: boost/version.hpp: No such file or directory #include <boost/version.hpp>. When I include the file in main.cpp, everything works fine. What should I do?

        My .pro file:

        QT += quick
        
        CONFIG += c++17
        
        DEFINES += QT_DEPRECATED_WARNINGS
        
        SOURCES += \
                main.cpp \
                signIn.cpp \
                signUp.cpp
        
        INCLUDEPATH += C:\mongo-cxx-driver-3.4.1\include\bsoncxx\v_noabi \ C:\mongo-cxx-driver-3.4.1\include\mongocxx\v_noabi \ D:\boost_1_72_0
        
        RESOURCES += qml.qrc
        
        TRANSLATIONS += \
            LogIn_en_CA.ts
        
        QML_IMPORT_PATH =
        
        QML_DESIGNER_IMPORT_PATH =
        
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        
        HEADERS += \
            signIn.h \
            signUp.h
        
        LIBS += C:\mongo-cxx-driver-3.4.1\lib\bsoncxx.lib \ C:\mongo-cxx-driver-3.4.1\lib\mongocxx.lib
        
        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #5

        @SimonR

        No such file or directory #include <boost/version.hpp>.

        I guess you need to provide INCLUDEPATH with a path that points to a place where you can later finder a subfolder boost which insides has a file version.hpp

        So since you provide D:/boost_1_72_0 does it hold there?
        I mean is your folder structure like this?:

        D:
        |---boost_1_72_0
            |---boost
                |---version.hpp
        

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        1
        • S Offline
          S Offline
          SimonR
          wrote on last edited by
          #6

          @Pablo-J-Rogina
          Yes, my folder structure looks excactly like you discribed it. The strange thing is that when I include it in the main file,
          it doesn't cause any errors. I've set up an test application in Visual Studio and everything works fine there.

          aha_1980A 1 Reply Last reply
          0
          • S SimonR

            @Pablo-J-Rogina
            Yes, my folder structure looks excactly like you discribed it. The strange thing is that when I include it in the main file,
            it doesn't cause any errors. I've set up an test application in Visual Studio and everything works fine there.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @SimonR

            What happens if you fix your include path?

            INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \ 
                  C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \ 
                  D:/boost_1_72_0
            

            Also, please show the compile output line leading to this error so we can check the flags passed to the compiler.

            Qt has to stay free or it will die.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SimonR
              wrote on last edited by SimonR
              #8

              Strange, it's compiling now. But when I try to access a database using

              mongocxx::instance inst{
              mongocxx::client conn{ mongocxx::uri{"connection string goes here"} };
              bsoncxx::builder::stream::document document{};
              

              , I get lots of errors. I think these are linking errors.

              d8ca774c-eef3-492d-8fdb-f49314a757f9-image.png

              Please excuse that I ask a lot, but I'm new to Qt Creator.

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

                Hi,

                Are you sure that the libraries are of the correct architecture and built by the same compiler ?

                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
                2
                • S Offline
                  S Offline
                  SimonR
                  wrote on last edited by
                  #10

                  The compiler used for building the driver was MSVC, so that might be an issue because Qt Creator uses MinGW. How can I change the compiler?

                  mrjjM 1 Reply Last reply
                  0
                  • S SimonR

                    The compiler used for building the driver was MSVC, so that might be an issue because Qt Creator uses MinGW. How can I change the compiler?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @SimonR
                    Hi
                    Use Qt maintenance tool to install the visual studio version of Qt for 2017/2019 32/64 VS
                    and then go and download the compiler from Microsoft site.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SimonR
                      wrote on last edited by
                      #12

                      @mrjj
                      Can you please provide me better guide how to change the compiler? I've looked it up in the internet but I haven't found anything useful. Ans can I still compile QML applications with MSVC?

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

                        Well: go to the Microsoft website, download the Visual Studio installer, then execute it.

                        As for Qt Quick, the compiler has no role here. As long as you have the modules built, it will work.

                        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
                        • S Offline
                          S Offline
                          SimonR
                          wrote on last edited by
                          #14

                          So, I have Visual Studio now, anything else I have to do? The compiler is still MinGW.

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

                            As @mrjj already suggested, did you install the MSVC build of Qt ?

                            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
                            • S Offline
                              S Offline
                              SimonR
                              wrote on last edited by
                              #16

                              When I open Qt Maintenance Tool, it looks like this:
                              38cedf62-5358-438d-b3b4-0e3f8b27bcfd-image.png

                              jsulmJ 1 Reply Last reply
                              0
                              • S SimonR

                                When I open Qt Maintenance Tool, it looks like this:
                                38cedf62-5358-438d-b3b4-0e3f8b27bcfd-image.png

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                @SimonR Did you select Kit configured for MSVC compiler/Qt to build you project?

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

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  SimonR
                                  wrote on last edited by SimonR
                                  #18

                                  I've selected the right compiler now,
                                  40fa38e3-8282-4101-ad3d-f6958120265c-image.png
                                  but when I try to run the program, I get an error.
                                  1f000937-a8e5-4c5e-8ff6-d61d251da9d9-image.png
                                  When I open the kits section, it shows some warnings:
                                  07d09771-b8c0-44aa-aa74-d29089de6514-image.png
                                  Is this normal? Or do I have to set up something else? Also, I found out that you can change it compiler, but it only shows amd64 and x86 architecture. I have an Intel processor, can I still use the amd64 because I haven't found the right settings for Intel processors?
                                  b812af3a-963f-4931-8966-50c00457d3e6-image.png

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • S SimonR

                                    I've selected the right compiler now,
                                    40fa38e3-8282-4101-ad3d-f6958120265c-image.png
                                    but when I try to run the program, I get an error.
                                    1f000937-a8e5-4c5e-8ff6-d61d251da9d9-image.png
                                    When I open the kits section, it shows some warnings:
                                    07d09771-b8c0-44aa-aa74-d29089de6514-image.png
                                    Is this normal? Or do I have to set up something else? Also, I found out that you can change it compiler, but it only shows amd64 and x86 architecture. I have an Intel processor, can I still use the amd64 because I haven't found the right settings for Intel processors?
                                    b812af3a-963f-4931-8966-50c00457d3e6-image.png

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    @SimonR Run it through debugger - looks like it is crashing.

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

                                    1 Reply Last reply
                                    1
                                    • S Offline
                                      S Offline
                                      SimonR
                                      wrote on last edited by
                                      #20

                                      So I've set up the compiler now, but when I run the application I get errors:
                                      4ba8dbb8-adb6-4ec1-9dec-bce6b42e8574-image.png

                                      I don't know why the language is German, because it's set to English. But as far as I know, those errors are linking errors, so I guess the libraries are not included correctly.

                                      Here is my .pro file:

                                      QT += quick
                                      
                                      CONFIG += c++17
                                      
                                      DEFINES += QT_DEPRECATED_WARNINGS
                                      
                                      SOURCES += \
                                              main.cpp \
                                              signIn.cpp \
                                              signUp.cpp
                                      
                                      INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \
                                                     C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \
                                                     D:/boost_1_72_0
                                      
                                      RESOURCES += qml.qrc
                                      
                                      TRANSLATIONS += \
                                          LogIn_en_CA.ts
                                      
                                      QML_IMPORT_PATH =
                                      
                                      QML_DESIGNER_IMPORT_PATH =
                                      
                                      qnx: target.path = /tmp/$${TARGET}/bin
                                      else: unix:!android: target.path = /opt/$${TARGET}/bin
                                      !isEmpty(target.path): INSTALLS += target
                                      
                                      HEADERS += \
                                          signIn.h \
                                          signUp.h
                                      
                                      LIBS += -LC:/mongo-cxx-driver-3.4.1/lib -lbsoncxx \
                                              -LC:/mongo-cxx-driver-3.4.1/lib -lmongocxx
                                      
                                      jsulmJ 1 Reply Last reply
                                      0
                                      • S SimonR

                                        So I've set up the compiler now, but when I run the application I get errors:
                                        4ba8dbb8-adb6-4ec1-9dec-bce6b42e8574-image.png

                                        I don't know why the language is German, because it's set to English. But as far as I know, those errors are linking errors, so I guess the libraries are not included correctly.

                                        Here is my .pro file:

                                        QT += quick
                                        
                                        CONFIG += c++17
                                        
                                        DEFINES += QT_DEPRECATED_WARNINGS
                                        
                                        SOURCES += \
                                                main.cpp \
                                                signIn.cpp \
                                                signUp.cpp
                                        
                                        INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \
                                                       C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \
                                                       D:/boost_1_72_0
                                        
                                        RESOURCES += qml.qrc
                                        
                                        TRANSLATIONS += \
                                            LogIn_en_CA.ts
                                        
                                        QML_IMPORT_PATH =
                                        
                                        QML_DESIGNER_IMPORT_PATH =
                                        
                                        qnx: target.path = /tmp/$${TARGET}/bin
                                        else: unix:!android: target.path = /opt/$${TARGET}/bin
                                        !isEmpty(target.path): INSTALLS += target
                                        
                                        HEADERS += \
                                            signIn.h \
                                            signUp.h
                                        
                                        LIBS += -LC:/mongo-cxx-driver-3.4.1/lib -lbsoncxx \
                                                -LC:/mongo-cxx-driver-3.4.1/lib -lmongocxx
                                        
                                        jsulmJ Offline
                                        jsulmJ Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #21

                                        @SimonR Looks like you're not linking properly against mongocxx. Which compiler was used to build those libraries and are they 32bit or 64bit?

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

                                        1 Reply Last reply
                                        1
                                        • S Offline
                                          S Offline
                                          SimonR
                                          wrote on last edited by
                                          #22

                                          I've played with the setting a bit and now, it compiles, but it doesn't run and shows an error:
                                          200de448-d179-49ab-88a2-548f494b1f64-image.png

                                          And when it try do run the debugger, it also shows an error:
                                          bf60b637-3af4-462b-83a2-97be35929eb7-image.png

                                          jsulmJ 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