Error when building mongocxx driver on Windows

This issue happens to Mac OS X as well, and maybe to other Un*xes.

  1. Use version 3.0.2 (at least). (The official guide mentions 3.0.1, but there is a bug fixed in 3.0.2).

curl -OL

  1. I didn’t change to build directory, but to the root:

cd mongo-cxx-driver-r3.0.2

  1. If the C mongo driver (and libbson) isn’t at the default directory, tell it to the cmake command, as well as say we are featuring modern C++ (11, 14, …). In my case: C mongo driver is on /opt/mongodbDriverCpp (the same place to put on C++ mongo driver).

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/mongodbDriverCpp -DLIBBSON_DIR=/opt/mongodbDriverCpp -DLIBMONGOC_DIR=/opt/mongodbDriverCpp -DCMAKE_CXX_STANDARD=14

  1. Make and Install

make make install

  1. The command to compile the test from the official guide (change /opt/mongodbDriverCpp to your right directory):

c++ --std=c++11 test.cpp -o run.test -I/opt/mongodbDriverCpp/include/bsoncxx/v_noabi -I /opt/mongodbDriverCpp/include/mongocxx/v_noabi/ -L /opt/mongodbDriverCpp/lib -l mongocxx -l bsoncxx

  1. Run (start the mongodb server first)

export LD_LIBRARY_PATH=/opt/mongodbDriverCpp/lib ./run.test

@Domenick_Smith the subject of your post indicates that you encountered an error, but the text of your post does not describe any error nor does it report an actual error message. Please provide the output of the cmake, make, and make install commands, along with the output of your test program compilation command and the attempt to execute it. This will assist in diagnosing the issue you are encountering.