在python中包含c++代码时,Swig返回“未指定模块名称”错误

2024-04-24 12:08:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在Python中包含C++代码,并决定使用Sigg。在

我从swig网站上的tutorial中学习了这个例子。在

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

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

int fact(int n);

一。在

^{pr2}$

一。在

^{3}$

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

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

我怎么能避开呢?在


Tags: 代码init网站examplewithtutorial例子file