Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2037

Cannot build on Windows with Visual Studio 2019

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc0, 3.6.0
    • Affects Version/s: 3.4.2, 3.5.1
    • Component/s: Build
    • None
    • Environment:
      Windows 10 x64
      cl.exe version 19.26.28806 for x64

      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]
      

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrea.bebertoldo@gmail.com Andrea Bertoldo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: