c语言中错误c2062,错误C2062:意外的int类型

我是c++和SWIG的新手

我正在windows环境中使用SWIG创建一个python模块。

创建包装类(例如wrap.cxx)之后。开始使用(python setup.py build_ext--inplace)创建python模块。

但是我得到了*example_wrap.cxx(3090):error c262:type'int'unexpected*

等级复杂.h:class GradedComplex

{

public:

typedef std::complex dcomplex;

typedef Item item_type;

typedef ItemComparator comparator;

typedef std::set grade_type;

private:

int n_;

std::vector grade_;

std::vector thre_;

public:

GradedComplex(int n, double *thre);

~GradedComplex();

void push(item_type item);

void avg(double *buf);

};

#endif

GradedComplex.cc级GradedComplex::GradedComplex(int n, double *thre)

{

n_ = n;

for (int i = 0; i < n_; ++i)

{

thre_.push_back(thre[i]);

grade_.push_back(new grade_type());

}

}

然后我使用SWIG构建它来生成python模块。

Swig接口文件(example.i)

GradedComplex(整数n,双*thre)

我对SWIG接口文件不是很在行

生成的包装器类有大量代码,因此我粘贴的代码很少。

代码:example_wrap.cxx3083: #define SWIG_FILE_WITH_INIT

3084: #include "Item.h"

3085: #include "GradedComplex.h"

3086: typedef std::complex dcomplex;

3087: typedef Item item_type;

3088: typedef ItemComparator comparator;

3089: typedef std::set grade_type;

3090: GradedComplex(int n, double *thre);

3091: void push(item_type item);

3092: void avg(double *buf);

3093: #include

3094: #include

3095: #include

3096: #if PY_VERSION_HEX >= 0x03020000

3097: # define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))

3098: #else

3099: # define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))

3100: #endif

GradedComplex构造函数:GradedComplex::GradedComplex(int n, double *thre)

{

n_ = n;

for (int i = 0; i < n_; ++i)

{

thre_.push_back(thre[i]);

grade_.push_back(new grade_type());

}

}

请建议a更正此错误

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值