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

Error compiling on MSVC with C++17 as target

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5.0
    • Affects Version/s: None
    • Component/s: BSON, Documentation
    • None

      On mongo-cxx-driver/src/bsoncxx/stdx/make_unique.hpp, when building with MSVC targeted for C++17, we have an error, because of MSVC problem with __cplusplus variable . Because of that, we get the error "Cannot find a valid polyfill for make_unique".

      To fix this, we can either:

      • Use #elif defined(BSONCXX_POLY_USE_STD) instead of the current #elif __cplusplus >= 201402L
      • On CmakeLists.txt add the "/Zc:__cplusplus" to the target_compile_options if the compiler is MSVC and C++17 is ON as a polyfill.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            mpoeira Miguel Cunha
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: