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

Error compiling on MSVC with C++17 as target

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 3.5.0
    • BSON, Documentation
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: