Hello everyone. This is my first post so please forgive any mistakes I may make
For a bit of background, I am an analyst in the insurance industry and I have a fair amount of experience programming in python, .NET and a little bit of C++. I have used MongoDB in C# quite a bit, but not in C++.
One of the pieces of software we use is called RAFM. Its basically Microsoft Visual Studio with some extra custom components on top and its all based on C++. I am currently trying to work out how to add a MongoDB connection to that model, so that we can query inputs more generically. So, I have been trying to build the mongocxx driver and link it in the solution and get it to build. RAFM provides a way to link in external libraries and headers
As far as I can tell, RAFM compiles to the C++ 14 standard and is using the MSVC17 compiler
I attempted to build this manually at first, but to be honest I found the C++ build instructions extremely confusing (considering I have no experience using linkers, compiler flags and build options etc) and after some more googling opted to use vcpkg to build it for me.
I added a flag into a custom vcpkg triplet to set the C++ standard to C++14 and had these two choices on vcpkg to install mongo
Driver | Version | Description |
---|---|---|
mongo-cxx-driver | 3.7.0 | MongoDB C++ Driver. |
mongo-cxx-driver[boost] | Enables the Boost C++17 polyfill for bsoncxx. |
I have installed the boost version using the custom triplet as I have used boost a bit before and am vaguely aware of the need to have some implementation for optional in C++ < 17, so thought perhaps this would use boosts version automatically? (not sure about this though)
When I get the libs and headers and link them into RAFM, they are detected but attempting to build them results in a 117 build errors. I have spent a fair amount of time googling these errors but have not been able to find anything particularly helpful. Here are the first few of those errors:
Severity | Code | Description | Project | File | Line |
---|---|---|---|---|---|
Error | ‘aggregate’: is not a member of ‘mongocxx::mongocxx::v_noabi::options’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 162 | |
Error | syntax error: missing ‘,’ before ‘&’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 162 | |
Error | missing type specifier - int assumed. Note: C++ does not support default-int | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 162 | |
Error | missing type specifier - int assumed. Note: C++ does not support default-int | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 187 | |
Error | syntax error: missing ‘,’ before ‘&’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 187 | |
Error | ‘aggregate’: is not a member of ‘mongocxx::mongocxx::v_noabi::options’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 187 | |
Error | ‘bulk_write’: is not a member of ‘mongocxx::mongocxx::v_noabi::options’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 204 | |
Error | ‘bulk_write’: is not a member of ‘mongocxx::mongocxx::v_noabi::options’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 219 | |
Error | ‘bulk_write’: is not a member of ‘mongocxx::mongocxx::v_noabi::result’ | MongoDBInputs | c:\local\vcpkg\installed\x64-windows-cpp14\include\mongocxx\collection.hpp | 246 |
There are several references to an erroneous location “mongocxx::mongocxx::v_noabi::options” which does not seem to exist in the headers, even though I can find no actual references in the headers to that location.
So I am asking if anyone has seen these kinds of issues before, or if anyone otherwise knows what is going wrong here so that I can get it to build. I apologise if this is a noob question. Please bare in mind I do not have any other experience using cmake or any other C++ specific built tools, so I will would very much appreciate clear instructions
Thanks in advance