Creating a DLL from a wrapped cpp file with SWIG

前端 未结 8 1910
刺人心
刺人心 2021-01-02 20:42

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         


        
8条回答
  •  借酒劲吻你
    2021-01-02 20:54

    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 
    # define _DEBUG
    #else
    # include 
    #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.

提交回复
热议问题