From c7363fd95ee97144147aebc7e1cd858c17c78687 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 15 Nov 2018 08:29:17 +0000 Subject: [PATCH] Workaround for Python gcc MingGW WIN32 hypot declaration error Fixes: In file included from C:/msys64/mingw32/include/c++/7.3.0/math.h:36:0, from C:/Python27/include/pyport.h:325, from C:/Python27/include/Python.h:61, from example_wrap.cxx:174: C:/msys64/mingw32/include/c++/7.3.0/cmath:1136:11: error: '::hypot' has not been declared using ::hypot; ^~~~~ See https://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python/28683412 and https://bugs.python.org/issue11566 --- Lib/python/pyruntime.swg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/python/pyruntime.swg b/Lib/python/pyruntime.swg index 26d3081a0..751bc8d5f 100644 --- a/Lib/python/pyruntime.swg +++ b/Lib/python/pyruntime.swg @@ -1,4 +1,9 @@ %insert(runtime) %{ +#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) +/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ +# include +#endif + #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) /* Use debug wrappers with the Python release dll */ # undef _DEBUG