How to resolve mongocxx driver parse error?

Installed mongocxx driver version 3.10.1 on linux using tarball from github(also installed mongo-c driver version 1.27.5).

For installation i used below commands for mongo-c driver:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>tar -xzf mongo-c-driver.tar.gz
cd mongo-c-driver-1.27.5/
mkdir cmake-build
cd cmake-build/
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_MONGODB_AWS_AUTH=OFF -DOPENSSL_ROOT_DIR=/usr/bin/openssl ..
make
sudo make install
</code>
<code>tar -xzf mongo-c-driver.tar.gz cd mongo-c-driver-1.27.5/ mkdir cmake-build cd cmake-build/ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_MONGODB_AWS_AUTH=OFF -DOPENSSL_ROOT_DIR=/usr/bin/openssl .. make sudo make install </code>
tar -xzf mongo-c-driver.tar.gz
cd mongo-c-driver-1.27.5/  
mkdir cmake-build 
cd cmake-build/  
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_MONGODB_AWS_AUTH=OFF -DOPENSSL_ROOT_DIR=/usr/bin/openssl  .. 
make  
sudo make install

And for the mongocxx driver used below commands:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>tar -xzf mongo-cxx-driver-r3.10.1.tar.gz
cd mongo-cxx-driver-r3.10.1/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFF -DBSONCXX_POLY_USE_BOOST=1
cmake --build .
sudo cmake --build . --target install
</code>
<code>tar -xzf mongo-cxx-driver-r3.10.1.tar.gz cd mongo-cxx-driver-r3.10.1/build cmake .. -DCMAKE_BUILD_TYPE=Release -DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFF -DBSONCXX_POLY_USE_BOOST=1 cmake --build . sudo cmake --build . --target install </code>
tar -xzf mongo-cxx-driver-r3.10.1.tar.gz 
cd mongo-cxx-driver-r3.10.1/build 
cmake .. -DCMAKE_BUILD_TYPE=Release -DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFF     -DBSONCXX_POLY_USE_BOOST=1 
cmake --build .
sudo cmake --build . --target install

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.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>INCLUDEPATH += /usr/local/include/mongocxx/v_noabi
/usr/local/include/bsoncxx/v_noabi
LIBS += -L/usr/local/lib64 -lmongocxx -lbsoncxx
</code>
<code>INCLUDEPATH += /usr/local/include/mongocxx/v_noabi /usr/local/include/bsoncxx/v_noabi LIBS += -L/usr/local/lib64 -lmongocxx -lbsoncxx </code>
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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>mongocxx/client.hpp
mongocxx/uri.hpp
mongocxx/instance.hpp
mongocxx/database.hpp
mongocxx/collection.hpp
bsoncxx/builder/stream/document.hpp
</code>
<code>mongocxx/client.hpp mongocxx/uri.hpp mongocxx/instance.hpp mongocxx/database.hpp mongocxx/collection.hpp bsoncxx/builder/stream/document.hpp </code>
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.

1

In the official documentation first they recommend to use pkg-config to get all the correct compilation flags. Check the output of

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>pkg-config --cflags --libs libmongocxx
</code>
<code>pkg-config --cflags --libs libmongocxx </code>
pkg-config --cflags --libs libmongocxx

most likely there are more required include directories (on my Ubuntu there is also /usr/local/include/bsoncxx/v_noabi/bsoncxx/third_party/mnmlstc).

Now to use the output of pkg-config with your Qt Creator you don’t need to copy-paste these flags in your *.pro file, instead use this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>SOURCES += main.cpp
CONFIG += link_pkgconfig
PKGCONFIG += libmongocxx
TARGET = hello
</code>
<code>SOURCES += main.cpp CONFIG += link_pkgconfig PKGCONFIG += libmongocxx TARGET = hello </code>
SOURCES += main.cpp
CONFIG += link_pkgconfig
PKGCONFIG += libmongocxx
TARGET = hello

It will allow you to compile simple hello world including mongocxx headers:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include <mongocxx/client.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/database.hpp>
#include <mongocxx/collection.hpp>
#include <bsoncxx/builder/stream/document.hpp>
int main() {
return 0;
}
</code>
<code>#include <mongocxx/client.hpp> #include <mongocxx/uri.hpp> #include <mongocxx/instance.hpp> #include <mongocxx/database.hpp> #include <mongocxx/collection.hpp> #include <bsoncxx/builder/stream/document.hpp> int main() { return 0; } </code>
#include <mongocxx/client.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/database.hpp>
#include <mongocxx/collection.hpp>
#include <bsoncxx/builder/stream/document.hpp>

int main() {
  return 0;
}

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật