Swig返回';未指定模块名称';包含c+时出错+;python代码 我想在Python中包含C++代码,并决定使用SWIG。

Swig返回';未指定模块名称';包含c+时出错+;python代码 我想在Python中包含C++代码,并决定使用SWIG。,python,swig,Python,Swig,我在swig站点上遵循了来自的示例 /* File: example.i */ %module example %{ #define SWIG_FILE_WITH_INIT #include "example.h" %} int fact(int n); 如果我运行命令来包装它,我会得到以下结果 swig -c++ -python example.i No module name specified using %module or -module. 我怎样才能避免这种情况呢?该示例如

我在swig站点上遵循了来自的示例

/* File: example.i */
%module example

%{
#define SWIG_FILE_WITH_INIT
#include "example.h"
%}

int fact(int n);

如果我运行命令来包装它,我会得到以下结果

swig -c++ -python example.i
No module name specified using %module or -module.

我怎样才能避免这种情况呢?

该示例如前所述非常好,效果很好。一定是别的问题,但老实说,我猜不出可能是什么。解决了它。。。Txtfile示例。我没有被保存。。。
/* File: example.h */

int fact(int n);
swig -c++ -python example.i
No module name specified using %module or -module.