[CXX-2037] Cannot build on Windows with Visual Studio 2019 Created: 08/Jun/20  Updated: 28/Oct/23  Resolved: 24/Jun/20

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: 3.4.2, 3.5.1
Fix Version/s: 3.6.0-rc0, 3.6.0

Type: Bug Priority: Major - P3
Reporter: Andrea Bertoldo Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10 x64
cl.exe version 19.26.28806 for x64


Issue Links:
Duplicate
is duplicated by CXX-1952 Mongo-cxx-driver compile failed with ... Closed
is duplicated by CXX-2047 Error occured while installing mongoc... Closed
Related
related to CXX-2039 Test compilation with VS 2019 on Ever... Closed

 Description   

I'm trying to build the C++ driver on Windows with the VC compiler, with no luck.
I tried driver versions 3.4.2 (manually downloaded) and 3.5.1 (the stable branch on github).
I configure the build with the following CMake command:

 
cmake -G "Visual Studio 16 2019" -A x64
  -DCMAKE_CXX_STANDARD=17
  -DCMAKE_CXX_FLAGS="/Zc:__cplusplus /D_ENABLE_EXTENDED_ALIGNED_STORAGE=1"
  -DBOOST_ROOT="C:/Code/boost_1_73_0"
  -DCMAKE_PREFIX_PATH=C:\mongo-c-driver
  -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver
  -DCMAKE_BUILD_TYPE=Release
  ..

but I keep getting the following error when I run msbuild.exe ALL_BUILD.vcxproj:

 

"C:\Code\mongo-cxx-driver-r3.4.2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Code\mongo-cxx-driver-r3.4.2\build\src\mongocxx\mongocxx.vcxproj" (default target) (5) ->
(ClCompile target) ->
 C:\Code\mongo-cxx-driver-r3.4.2\src\mongocxx\instance.cpp(79,76): error C2338: Must be trivially constructible [C:\Co
de\mongo-cxx-driver-r3.4.2\build\src\mongocxx\mongocxx.vcxproj]
 
"C:\Code\mongo-cxx-driver-r3.4.2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Code\mongo-cxx-driver-r3.4.2\build\src\mongocxx\mongocxx_mocked.vcxproj" (default target) (6) ->
 C:\Code\mongo-cxx-driver-r3.4.2\src\mongocxx\instance.cpp(79,76): error C2338: Must be trivially constructible [C:\Co
de\mongo-cxx-driver-r3.4.2\build\src\mongocxx\mongocxx_mocked.vcxproj]

 



 Comments   
Comment by Kevin Albertson [ 24/Jun/20 ]

https://github.com/mongodb/mongo-cxx-driver/pull/654/ has been merged.

Comment by Kevin Albertson [ 11/Jun/20 ]

Hello andrea.bebertoldo@gmail.com, thank you for the report. There is an open PR with a proposed change to address this: https://github.com/mongodb/mongo-cxx-driver/pull/654/files and some additional discussion.

Generated at Wed Feb 07 22:04:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.