Skip to content

Commit

Permalink
Fix "_invalid_parameter_noinfo_noreturn" link error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jcfr committed Aug 2, 2022
1 parent 0401ef8 commit 0a46737
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/PythonQtPythonInclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
// release Python DLL if it is available by undefining _DEBUG while
// including Python.h
#if defined(PYTHONQT_USE_RELEASE_PYTHON_FALLBACK) && defined(_DEBUG)
#undef _DEBUG
# define PYTHONQT_UNDEF_DEBUG
// Include these low level headers before undefing _DEBUG. Otherwise when doing
// a debug build against a release build of python the compiler will end up
// including these low level headers without DEBUG enabled, causing it to try
Expand All @@ -80,14 +80,17 @@
# include <sys/stat.h>
# include <time.h>
# include <wchar.h>
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define _CRT_NOFORCE_MANIFEST 1
#define _STL_NOFORCE_MANIFEST 1
# undef _DEBUG
# if defined(_MSC_VER) && _MSC_VER >= 1400
# define _CRT_NOFORCE_MANIFEST 1
# define _STL_NOFORCE_MANIFEST 1
# endif
#endif

#include <Python.h>
#define _DEBUG
#else
#include <Python.h>

#ifdef PYTHONQT_UNDEF_DEBUG
# define _DEBUG
#endif

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

0 comments on commit 0a46737

Please sign in to comment.