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. Implement MongoDB with Qt: mongocxx

Implement MongoDB with Qt: mongocxx

Scheduled Pinned Locked Moved Solved General and Desktop
c++linuxarch linuxmongodb
12 Posts 4 Posters 2.0k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    What error are you getting exactly ?

    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
    • A Offline
      A Offline
      Arush Gupta
      wrote on last edited by
      #3

      Hi,
      I get file not found errors on these lines:

      #include <bsoncxx/json.hpp>
      #include <mongocxx/client.hpp>
      #include <mongocxx/stdx.hpp>
      #include <mongocxx/uri.hpp>
      #include <mongocxx/instance.hpp>
      

      Thanks

      JonBJ 1 Reply Last reply
      0
      • A Arush Gupta

        Hi,
        I get file not found errors on these lines:

        #include <bsoncxx/json.hpp>
        #include <mongocxx/client.hpp>
        #include <mongocxx/stdx.hpp>
        #include <mongocxx/uri.hpp>
        #include <mongocxx/instance.hpp>
        

        Thanks

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #4

        @Arush-Gupta
        This is not my area, so may not be correct, but while you wait for an expert to comment....

            -I/usr/local/include/mongocxx/v_noabi \
            -I/usr/local/include/bsoncxx/v_noabi
        

        This tells compiler to look in those two directories for files. But your includes read #include <mongocxx/instance.hpp> etc. So to find those paths it needs (presumably) to look down from /usr/local/include to find /usr/local/include/mongocxx/instance.hpp (assuming that is correct). In which case, if compiler does not already look automatically in /usr/local/include (I don't know if it does) you would need -I/usr/local/include?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Arush Gupta
          wrote on last edited by
          #5

          Hi,
          Thanks for the response
          But that does not fix it :(
          .pro:

          INCLUDEPATH += \
              -I/usr/local/include/
          
          LIBS += \
              -L/usr/local/lib \
              -lmongocxx \
              -lbsoncxx
          

          Thanks

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

            Where are the files you include located on your hard drive exactly ?

            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
            • A Offline
              A Offline
              Arush Gupta
              wrote on last edited by
              #7

              Hi,
              /usr/local/include/mongocxx/v_noabi/ contains folder mongocxx and /usr/local/include/bsoncxx/v_noabi/ contains folder bsoncxx.
              Thanks

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

                I see your issue now. Go back to the original paths you were using but remove the -I before the path, they are unneeded with the INCLUDEPATH variable.

                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
                • A Offline
                  A Offline
                  Arush Gupta
                  wrote on last edited by
                  #9

                  Hi,
                  Thanks it worked, I was able to import it, but another issue poped up:

                  error: 'bsoncxx::v_noabi::builder::stream' has not been declared
                     20 | using bsoncxx::builder::stream::close_array;
                        |                         ^~~~~~
                  

                  But I can see folder stream inside builder inside bsoncxx.
                  In the error I see that it want's to import bsoncxx::v_noabi::builder::stream but I want it to use bsoncxx::v_noabi::bsoncxx::builder::stream
                  Thanks

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

                    That I do not know.

                    Can you provide a minimal example that triggers this error ?

                    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
                    • A Offline
                      A Offline
                      Arush Gupta
                      wrote on last edited by
                      #11

                      Sorry for the late response,
                      I solved the issue by reinstalling the packages
                      Thanks for the help.

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

                        Hi, what did you make different for this reinstallation?

                        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