Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Solved Implement MongoDB with Qt: mongocxx

    General and Desktop
    c++ linux arch linux mongodb
    3
    11
    780
    Loading More Posts
    • 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.
    • SGaist
      SGaist Lifetime Qt Champion last edited by

      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 Reply Quote 0
      • A
        Arush Gupta last edited by

        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

        JonB 1 Reply Last reply Reply Quote 0
        • JonB
          JonB @Arush Gupta last edited by

          @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 Reply Quote 0
          • A
            Arush Gupta last edited by

            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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 0
              • A
                Arush Gupta last edited by

                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 Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  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 Reply Quote 0
                  • A
                    Arush Gupta last edited by

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 0
                      • A
                        Arush Gupta last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post