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

Error compiling on MSVC with C++17 as target

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.0-rc0
    • Component/s: BSON, Documentation
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: