2017-03-19 35 views
-1

运行swig界面文件时出现以下警告 警告325:当前不支持嵌套类(忽略代理)。 我能够抑制警告。但是我需要计算警告325:当前不支持嵌套类(代理被忽略)

下面嵌套类是接口文件(example.i)

%module example 
%{ 
#include "Rinside.h" 
#include "Rinsidecommon.h" 
#include "Callbacks.h" 
%} 
/* Let's just grab the original header file here */ 
%include "Rinside.h" 
%include "Rinsidecommon.h" 
%include "Callbacks.h" 

当执行接口文件。以下是警告

C:\swigwin-3.0.12\Examples\r\Rinside>swig -tcl -c++ example.i 
Rinside.h(70) : Warning 325: Nested class not currently supported (Proxy ignored) 
Rinside.h(91) : Warning 503: Can't wrap 'operator []' unless renamed to a valid identifier. 

我试图从Tcl的呼叫RInside。首先,我的C代码应该能够接受参数,通过传递这些参数来调用RInside,并打印RInside执行结果

下面是我在Rinside.h文件中的嵌套类。 如何在接口文件中包含嵌套类? 我是比较新的痛饮

class Proxy { 
public: 
    Proxy(SEXP xx): x(xx) { }; 

    template <typename T> 
    operator T() { 
     return ::Rcpp::as<T>(x); 
    } 
private: 
    Rcpp::RObject x; 
}; 

可有一个人请我提供一个骨架或代码的某些部分。这将有利于我

我收到以下错误,而包装的CPP代码

rinside_sample0_wrap.cxx: In function 'int _wrap_RInside_parseEval__SWIG_1(ClientData, Tcl_Interp*, int, Tcl_Obj* const*)':\ 
rinside_sample0_wrap.cxx:1906:18: error: no matching function for call to 'RInside::Proxy::Proxy()' 
In file included from rinside_sample0_wrap.cxx:1700:0: 
Rinside.h:61:6: note: candidate: RInside::Proxy::Proxy(SEXP) 
Proxy(SEXP xx): x(xx) { }; 
Rinside.h:61:6: note: candidate expects 1 argument, 0 provided 
+0

向我们展示一个重现问题的最小完整示例界面。 – Flexo

+0

编辑请帮忙 – Srin

回答

0

按照SWIG Documentation ...

兼容性注意:前痛饮-3.0。 0,嵌套类支持有限。嵌套类被视为不透明指针。然而,在这些旧版本中,嵌套类支持有一个解决方法,要求用户在全局范围内复制嵌套类,在全局范围内添加嵌套类的typedef,并在嵌套类中使用“嵌套工作区”功能。这导致了与“平面”特征大致相同的行为。通过SWIG-3.0.0中现有的适当的嵌套类支持,该功能已被弃用,不再需要更改代码。

因此,您应该使用3.0或更高版本来支持嵌套类。这将允许你避免需要压制任何东西,并可能修复你的其他问题。

+0

但我一直在使用swig - 3.0.12版本。我仍然不明白为什么我会收到警告和错误 – Srin

+0

在这种情况下,我不知道发生了什么。这听起来像是一些基本假设被违反。请联系SWIG作者/维护人员寻求帮助...... –