Search code examples
c++mongodbvisual-studio-2015mongo-cxx-driver

How to set up Visual Studio project settings with mongo-cxx-driver?


I have successfully build the version 3.0.3 of the MongoDB driver for C++ on Windows 10 with

CMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver

But I don't know how to set up a project in Visual Studio 2015 that can use this driver.
I found this post here, but I don't understand the exact solution. I tried the following properties but failed:

  • C/C++ > Additional Include Directories: C:\mongo-c-driver\include\libbson-1.0;C:\mongo-c-driver\include\libmongoc-1.0;C:\mongo-cxx-driver\include\bsoncxx\v_noabi;C:\mongo-cxx-driver\include\mongocxx\v_noabi;%(AdditionalIncludeDirectories)
  • Linker > Additional Library Directories: C:\mongo-cxx-driver\lib;%(AdditionalLibraryDirectories)

Visual Studio doesn't mark any errors, but when I try to compile the code, I get 401 errors.
I hope someone can help me.

EDIT: The complete list of all 401 errors is stored here.

EDIT: I startet a new project and used exactly the same settings. Now I just get 14 errors. The list of errors is stored here (EDIT: removed file).

EDIT: I added the following configuration:

  • Configuration Manager > Active Solution Platform: x64
  • C/C++ > Additional Include Directories: C:\Program Files\boost\boost_1_62_0;

Now I get the following errors.


Solution

  • First thank everyone for help! I got a workig solution with the following set up:

    • Configuration Manager > Active Solution Platform: x64
    • C/C++ > Additional Include Directories: C:\mongo-c-driver\include\libbson-1.0;C:\mongo-c-driver\include\libmongoc-1.0;C:\mongo-cxx-driver\include\bsoncxx\v_noabi;C:\mongo-cxx-driver\include\mongocxx\v_noabi;C:\Program Files\boost\boost_1_62_0;
    • Linker > Additional Library Directories: C:\mongo-cxx-driver\lib;
    • Linker > Input > Additional Dependencies: bsoncxx.lib;mongocxx.lib;
    • Build Events > Post-Build Event: COPY "C:\mongo-cxx-driver\bin\bsoncxx.dll" "$(OutDir)";COPY "C:\mongo-cxx-driver\bin\mongocxx.dll" "$(OutDir)";COPY "C:\mongo-c-driver\bin\libmongoc-1.0.dll" "$(OutDir)";COPY "C:\mongo-c-driver\bin\libbson-1.0.dll" "$(OutDir)";