onnxruntime/onnxruntime/python/onnxruntime_pybind.h
George Wu 09590f013a
fix windows ci debug build break (#11495)
* update msc version check

* update comment

* typo

* whitespace
2022-05-12 16:54:00 -07:00

18 lines
753 B
C

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
// If performing a debug build with VS2019 (>=16.11.14) or VS2022 (_MSC_FULL_VER >= 192930145)
// we need to include corecrt.h before pybind so that the _STL_ASSERT macro is defined in a compatible way.
//
// pybind11/pybind11.h includes pybind11/detail/common.h, which undefines _DEBUG whilst including the Python headers
// (which in turn include corecrt.h). This alters how the _STL_ASSERT macro is defined and causes the build to fail.
//
// see https://github.com/microsoft/onnxruntime/issues/9735
//
#if defined(_MSC_FULL_VER) && defined(_DEBUG) && _MSC_FULL_VER >= 192930145
#include <corecrt.h>
#endif
#include <pybind11/pybind11.h>