swig没有关于基类'std :: string'的知识,被忽略 [英] swig Nothing known about base class 'std::string', ignored

查看:1154
本文介绍了swig没有关于基类'std :: string'的知识,被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用swig建立一个c ++库周围的ruby包装。
大多数似乎都工作,但我有一个问题,我很肯定是与上述警告有关。



它看起来像一个类我包装是继承自std :: string。



当我运行swig时,看到上面的警告信息。



当我在一个对象上调用一个方法应该返回一个字符串,我看到这个



SWIG :: Type_p_std__string:0x ...

我想我需要一些如何解决上述警告,以工作,任何想法?

解决方案

SWIG抱怨它不知道std :: string类,所以不能为它生成代码。



SWIG库std_string.i具有用于将c ++字符串映射到目标语言字符串类的语言特定代码。在添加%包含std_string.i 之前生成您的类的代码应修正错误。



请注意,在$ swig接口文件中%include 不同于 #include


I am trying to use swig to build ruby wrappers around a c++ library. Most of it seems to be working but I have one issue that I am pretty sure is related to the above warning.

It looks like one of the classes I am wrapping is inherited from std::string.

I see the above warning message when I run swig.

When I call a method on an object in ruby that should be returning a string, I see this

SWIG::Type_p_std__string:0x.....

I am thinking I need to some how fix the above warning to the this to work, any ideas?

解决方案

SWIG is complaining that it doesn't know about the the std::string class and so cannot generate code for it.

The SWIG library std_string.i has language specific code for mapping the c++ string to the target languages string class. Adding %include "std_string.i" before the code that generates your class should fix the error.

Note that %include is different from #include in a swig interface file.

这篇关于swig没有关于基类'std :: string'的知识,被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆