Reputation: 313
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:
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:
Now I get the following errors.
Upvotes: 0
Views: 2123
Reputation: 313
First thank everyone for help! I got a workig solution with the following set up:
Upvotes: 0
Reputation: 2995
Here's a sample .vcxproj, assuming components are in separate directories. You can compare it to what you have:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>c:\local\boost_1_59_0\;C:\mongo-cxx-driver\include\mongocxx\v_noabi;C:\mongo-cxx-driver\include\bsoncxx\v_noabi;C:\mongo-c-driver\include\libmongoc-1.0;C:\mongo-c-driver\include\libbson-1.0;$(IncludePath)</IncludePath>
<LibraryPath>c:\libbson\lib;c:\mongo-c-driver\lib\;c:\mongo-cxx-driver\lib\;c:\libbson\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>MONGOCXX_STATIC;BSONCXX_STATIC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libmongocxx.lib;libbsoncxx.lib;mongoc-static-1.0.lib;bson-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
Upvotes: 0
Reputation: 35
I'm also trying to build driver with VS2015 (Windows7). I made following changes to project:
# C/C++ | General | Additional Include Directories:C:\work\mongo-cxx\mongo-cxx-driver-r3.0.3\src\bsoncxx\include\libbson-1.0;C:\work\mongo-cxx\mongo-cxx-driver-r3.0.3\src\mongocxx\include\libmongoc-1.0;C:\work\mongo-cxx\mongo-cxx-driver-r3.0.3\src;C:\work\mongo-cxx\libbson-1.5.0\src\bson;C:\work\mongo-cxx\mongo-c-driver-1.5.0\src\mongoc;
# C/C++ | Preprocessor | Preprocessor Definitions:MONGOCXX_STATIC;BSONCXX_STATIC;**
# Librarian | General | Additional Dependencies:libbsoncxx.lib;mongoc-static-1.0.lib;
# Librarian | General | Additional Dependencies:C:\work\mongo-cxx\mongo-cxx-driver-r3.0.3\src\bsoncxx\$(Configuration);C:\work\mongo-cxx\mongo-c-driver-1.5.0\$(Configuration);
# Librarian | General | Link Library Dependencies: Yes
But when I tried to link static lib with test example I get linker error eg:
unresolved external symbol __imp_bson_append_array.
It seems there is something else which should be changed in project settings.
Upvotes: 0