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. Mongocxx parse error with Qt
QtWS25 Last Chance

Mongocxx parse error with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 531 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.
  • S Offline
    S Offline
    shadow_78
    wrote on last edited by
    #1

    Hi ,
    Installed mongocxx driver version 3.10.1 on linux using tarball from github(also installed mongo-c driver version 1.27.5). I use it with qt c++ development with mongodb. But after including the mongocxx and bsoncxx .hpp files i get

    parse error at /.../include/bsoncxx/v_noabi/bsoncxx/enums/binary_sub_type.hpp types.hp 68

    on qt creator. Also says in the detail of the error:

    File not found /local/include/bsoncxx/v_noabi/bsoncxx/types.hp

    yes not ".hpp" it says "types.hp" . I get this while building my application. I can see the included .hpp source files of mongocxx and bsoncxx from my .cpp code. Library paths and includings also made on the .pro file of the project as below. Not getting any error from it.

    INCLUDEPATH += /usr/local/include/mongocxx/v_noabi
    /usr/local/include/bsoncxx/v_noabi
    LIBS += -L/usr/local/lib64 -lmongocxx -lbsoncxx
    And i included below classes:

    mongocxx/client.hpp
    mongocxx/uri.hpp
    mongocxx/instance.hpp
    mongocxx/database.hpp
    mongocxx/collection.hpp
    bsoncxx/builder/stream/document.hpp
    How can i resolve this error?

    Tried to build my qt c++ application and got this error from qt creator.

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Did you already look at the line from the error message to see what's there?

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

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

        Yes, types.hpp line 68 includes /bsoncxx/enums/binary_sub_type.hpp , and in the binary_sub_type.hpp file it says 'expected a declaration' , i check them on qt creator, these are same for official release as i check

        jsulmJ 1 Reply Last reply
        0
        • S shadow_78

          Yes, types.hpp line 68 includes /bsoncxx/enums/binary_sub_type.hpp , and in the binary_sub_type.hpp file it says 'expected a declaration' , i check them on qt creator, these are same for official release as i check

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

          @shadow_78 said in Mongocxx parse error with Qt:

          t says 'expected a declaration'

          Can you please show the exact line causing this error?

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

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

            https://mongocxx.org/api/current/binary__sub__type_8hpp_source.html , at line 19 flagged with expected a declaration

            1 Reply Last reply
            0
            • S shadow_78

              Hi ,
              Installed mongocxx driver version 3.10.1 on linux using tarball from github(also installed mongo-c driver version 1.27.5). I use it with qt c++ development with mongodb. But after including the mongocxx and bsoncxx .hpp files i get

              parse error at /.../include/bsoncxx/v_noabi/bsoncxx/enums/binary_sub_type.hpp types.hp 68

              on qt creator. Also says in the detail of the error:

              File not found /local/include/bsoncxx/v_noabi/bsoncxx/types.hp

              yes not ".hpp" it says "types.hp" . I get this while building my application. I can see the included .hpp source files of mongocxx and bsoncxx from my .cpp code. Library paths and includings also made on the .pro file of the project as below. Not getting any error from it.

              INCLUDEPATH += /usr/local/include/mongocxx/v_noabi
              /usr/local/include/bsoncxx/v_noabi
              LIBS += -L/usr/local/lib64 -lmongocxx -lbsoncxx
              And i included below classes:

              mongocxx/client.hpp
              mongocxx/uri.hpp
              mongocxx/instance.hpp
              mongocxx/database.hpp
              mongocxx/collection.hpp
              bsoncxx/builder/stream/document.hpp
              How can i resolve this error?

              Tried to build my qt c++ application and got this error from qt creator.

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

              @shadow_78 said in Mongocxx parse error with Qt:

              But after including the mongocxx and bsoncxx .hpp files i get

              I presume you mean you have some kind of #include <....hpp> for these two files in your own .cpp or .h source code? Could you show exactly where you do this? In particular, are they the first lines in whatever .cpp/.h of yours they appear in, or is there anything else which precedes them?

              File not found /local/include/bsoncxx/v_noabi/bsoncxx/types.hp

              This looks concerning. I don't know why that path and .hp. Does a .hpp of that file exist in that directory?

              INCLUDEPATH += /usr/local/include/mongocxx/v_noabi
              /usr/local/include/bsoncxx/v_noabi

              I guess you are using qmake not cmake? If you have copied and pasted those lines from your .pro file directly it does not look right. Since this is across two lines I would expect it to require

              INCLUDEPATH += /usr/local/include/mongocxx/v_noabi \
              /usr/local/include/bsoncxx/v_noabi
              

              Note the trailing backslash on the first line. No?

              S 1 Reply Last reply
              1
              • JonBJ JonB

                @shadow_78 said in Mongocxx parse error with Qt:

                But after including the mongocxx and bsoncxx .hpp files i get

                I presume you mean you have some kind of #include <....hpp> for these two files in your own .cpp or .h source code? Could you show exactly where you do this? In particular, are they the first lines in whatever .cpp/.h of yours they appear in, or is there anything else which precedes them?

                File not found /local/include/bsoncxx/v_noabi/bsoncxx/types.hp

                This looks concerning. I don't know why that path and .hp. Does a .hpp of that file exist in that directory?

                INCLUDEPATH += /usr/local/include/mongocxx/v_noabi
                /usr/local/include/bsoncxx/v_noabi

                I guess you are using qmake not cmake? If you have copied and pasted those lines from your .pro file directly it does not look right. Since this is across two lines I would expect it to require

                INCLUDEPATH += /usr/local/include/mongocxx/v_noabi \
                /usr/local/include/bsoncxx/v_noabi
                

                Note the trailing backslash on the first line. No?

                S Offline
                S Offline
                shadow_78
                wrote on last edited by
                #7

                @JonB

                I presume you mean you have some kind of #include <....hpp> for these two files in your own .cpp or .h source code? Could you show exactly where you do this? In particular, are they the first lines in whatever .cpp/.h of yours they appear in, or is there anything else which precedes them?
                

                Yeah they are #include <....hpp> from the first lines of class header (.h file).

                This looks concerning. I don't know why that path and .hp. Does a .hpp of that file exist in that directory?
                

                Yes both files are exist in bsoncxx path, types.hpp. But i dont know it says cant find types.hp , isnt it should be .hpp?

                Note the trailing backslash on the first line. No?
                

                Yes there is backslash between them, it is correct at the code

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

                  Hi,

                  Do you really need the unstable API part ? That look surprising.
                  Which headers are you currently using in your code ?

                  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
                    shadow_78
                    wrote on last edited by
                    #9

                    hi, Currently have below headers, but i dont explicitly add type.hpp file that includes binary_sub_type.hpp (parse error comes from)
                    mongocxx/client.hpp
                    mongocxx/uri.hpp
                    mongocxx/instance.hpp
                    mongocxx/database.hpp
                    mongocxx/collection.hpp
                    bsoncxx/builder/stream/document.hpp

                    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