Skip to content

Commit 6aa410e

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. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
1 parent ec51dc9 commit 6aa410e

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
@@ -60,7 +60,7 @@
6060
// release Python DLL if it is available by undefining _DEBUG while
6161
// including Python.h
6262
#if defined(PYTHONQT_USE_RELEASE_PYTHON_FALLBACK) && defined(_DEBUG)
63-
#undef _DEBUG
63+
# define PYTHONQT_UNDEF_DEBUG
6464
// Include these low level headers before undefing _DEBUG. Otherwise when doing
6565
// a debug build against a release build of python the compiler will end up
6666
// including these low level headers without DEBUG enabled, causing it to try
@@ -80,14 +80,17 @@
8080
# include <sys/stat.h>
8181
# include <time.h>
8282
# include <wchar.h>
83-
#if defined(_MSC_VER) && _MSC_VER >= 1400
84-
#define _CRT_NOFORCE_MANIFEST 1
85-
#define _STL_NOFORCE_MANIFEST 1
83+
# undef _DEBUG
84+
# if defined(_MSC_VER) && _MSC_VER >= 1400
85+
# define _CRT_NOFORCE_MANIFEST 1
86+
# define _STL_NOFORCE_MANIFEST 1
87+
# endif
8688
#endif
89+
8790
#include <Python.h>
88-
#define _DEBUG
89-
#else
90-
#include <Python.h>
91+
92+
#ifdef PYTHONQT_UNDEF_DEBUG
93+
# define _DEBUG
9194
#endif
9295

9396
// get Qt keywords back

0 commit comments

Comments
 (0)