I am in the process of learning how to use SWIG on Windows.
The following is my c++ code:
/* File : example.cxx */
#include \"example.h\"
#defin
add MS_NO_COREDLL definition at Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions; or add #define MS_NO_COREDLL line before including python.h.
#define MS_NO_COREDLL
#include <Python.h>
SWIG (at least on v3.0) generates the python.h inclusion in the wrapper as follows:
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
# define _DEBUG
#else
# include <Python.h>
#endif
So when compiling a debug version of the wrapper on a Windows platform, we simply need to define the SWIG_PYTHON_INTERPRETER_NO_DEBUG
flag to avoid the pyconfig.h
file issue mentioned in Ken's answer.
I resolved the missing python27_d.lib by doing the following:
define Py_DEBUG
You can try adding "python27_d.lib" (without quotes) to ignored libs:
Configuration Properties -> Linker -> Input -> Ignore Specific Library
I found out that addind the Python symbols do the Project solves it. Do it like this
I also copied the python27.lib to a file named python27_d.lib
Building the project in Release mode removes the python27_d.lib dependency too; at least it did for my own project.