Mongocxx parse error with Qt
-
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 getparse 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.
-
Did you already look at the line from the error message to see what's there?
-
@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://mongocxx.org/api/current/binary__sub__type_8hpp_source.html , at line 19 flagged with expected a declaration
-
@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_noabiI 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 requireINCLUDEPATH += /usr/local/include/mongocxx/v_noabi \ /usr/local/include/bsoncxx/v_noabi
Note the trailing backslash on the first line. No?
-
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
-
Hi,
Do you really need the unstable API part ? That look surprising.
Which headers are you currently using in your code ? -
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