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
Forum Updated to NodeBB v4.3 + New Features

Mongocxx parse error with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 561 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
    shadow_78
    wrote on 5 Sept 2024, 10:59 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.

    J 1 Reply Last reply 5 Sept 2024, 12:50
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 5 Sept 2024, 11:02 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 5 Sept 2024, 11:25 last edited by shadow_78 9 May 2024, 11:26
        #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

        J 1 Reply Last reply 5 Sept 2024, 11:48
        0
        • S shadow_78
          5 Sept 2024, 11:25

          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

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 5 Sept 2024, 11:48 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 5 Sept 2024, 12:33 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
              5 Sept 2024, 10:59

              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.

              J Offline
              J Offline
              JonB
              wrote on 5 Sept 2024, 12:50 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 5 Sept 2024, 13:57
              1
              • J JonB
                5 Sept 2024, 12:50

                @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 5 Sept 2024, 13:57 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 10 Sept 2024, 06:52 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 10 Sept 2024, 07:45 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

                    4/9

                    5 Sept 2024, 11:48

                    • Login

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