c++mongodbvisual-studio-2019mongo-cxx-drivervcpkg

Visual Studio 2019 x64 app using mongocxx driver


I'm trying to get a windows x64 C++ project working with the latest mongocxx driver using Visual Studio 2019. I installed the driver libraries using vcpkg:

vcpkg install mongo-cxx-driver[boost]

In VS 2019 I created a new console app and inserted the example code from the mongo driver page into main(). I built the app and ran it; everything works great. Then I noticed that it built as a win 32 app and switched it over to x64. Now the project won't build b/c it can't find the header files. Specifically (1rst error only...the others are similar)

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'bsoncxx/json.hpp': No such file or directory

What do I need to do to make it work on the x64 platform?


Solution

  • As I suspected, it was something I just didn't know to do. From Neumann-A on the vcpkg github site:

    vcpkg install mongo-cxx-driver[boost]:x64-windows

    or

    vcpkg install mongo-cxx-driver[boost] --triplet x64-windows

    or

    set VCPKG_DEFAULT_TRIPLET=x64-windows vcpkg install mongo-cxx-driver[boost]