Skip to content

Commit 7957c6e

Browse files
committed
Fix "_invalid_parameter_noinfo_noreturn" link error
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. Based on a similar fix in VTK. See: Kitware/VTK@81d4a72 See: commontk/PythonQt#9 Thanks to @Neosettler for reporting and testing. Reported-by: Neosettler (cherry picked from commit commontk/PythonQt@77d8177)
1 parent 03d628d commit 7957c6e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/PythonQtPythonInclude.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
// release Python DLL if it is available by undefining _DEBUG while
7373
// including Python.h
7474
#if defined(PYTHONQT_USE_RELEASE_PYTHON_FALLBACK) && defined(_DEBUG)
75-
#undef _DEBUG
75+
# define PYTHONQT_UNDEF_DEBUG
7676
// Include these low level headers before undefing _DEBUG. Otherwise when doing
7777
// a debug build against a release build of python the compiler will end up
7878
// including these low level headers without DEBUG enabled, causing it to try
@@ -92,14 +92,17 @@
9292
# include <sys/stat.h>
9393
# include <time.h>
9494
# include <wchar.h>
95-
#if defined(_MSC_VER) && _MSC_VER >= 1400
96-
#define _CRT_NOFORCE_MANIFEST 1
97-
#define _STL_NOFORCE_MANIFEST 1
95+
# undef _DEBUG
96+
# if defined(_MSC_VER) && _MSC_VER >= 1400
97+
# define _CRT_NOFORCE_MANIFEST 1
98+
# define _STL_NOFORCE_MANIFEST 1
99+
# endif
98100
#endif
101+
99102
#include <Python.h>
100-
#define _DEBUG
101-
#else
102-
#include <Python.h>
103+
104+
#ifdef PYTHONQT_UNDEF_DEBUG
105+
# define _DEBUG
103106
#endif
104107

105108
// By including Python.h on Linux truncate could have been defined (in unistd.h)

0 commit comments

Comments
 (0)