Docs Menu
Docs Home
/ / /
C++ Driver


On this page

  • Prerequisites
  • Installing
  • Advanced Options
  • Package Managers
  • Docker Image
  • Any standard Unix platform, or Windows 7 SP1+

  • A compiler that supports C++11 (gcc, clang, or Visual Studio)

  • CMake 3.15 or later

  • boost headers (optional)

If you encounter build failures or other problems with a platform configuration that meets the above prerequisites, please file a bug report via JIRA.

To configure and install the driver, follow the instructions for your platform:

  • Configuring and installing on Windows

  • Configuring and installing on macOS

  • Configuring and installing on Linux

The Mongo C++ driver is available in the following package managers.

If you do not already have Vcpkg installed, install it with the following command:

$ git clone
$ cd vcpkg
$ ./

Optionally, to install with Visual Studio integration:

vcpkg integrate install

Install the driver. You may need to git pull to get the latest version of the driver.

$ ./vcpkg install mongo-cxx-driver

You can use the toolchain file, vcpkg.cmake, to instruct CMake where to find the development files, for example:

-DCMAKE_TOOLCHAIN_FILE=/<path to vcpkg repo>/vcpkg/scripts/buildsystems/vcpkg.cmake

You can find the header files in:

vcpkg/installed/<CPU ARCHITECTURE>-<OPERATING SYSTEM>/include/

The library files are in:


Package Specifier: mongo-cxx-driver/3.8.0

If you do not already have Conan installed, then install it and run the Conan initalization command below:

$ pip install conan
$ conan profile detect --force

Add the following to your conanfile.txt:


Install the driver via Conan, and build your project:

$ conan install conanfile.txt --output-folder=build --build=missing
$ cmake \
-B build \
-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
$ cmake --build build

For MacOS users, homebrew is a convenient way to install the C++ driver.

brew install mongo-cxx-driver

Headers can be found in:


Library files can be found in:


Headers can be found in:


Library files can be found in:


You can find a pre-built docker image for the C++ driver in Docker Hub.


Choosing a C++17 Polyfill


Installation on Windows