警告 325:当前不支持嵌套类(忽略代理)



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

下面是接口文件(示例.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.12ExamplesrRinside>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

根据 SWIG 文档...

兼容性说明:在 SWIG-3.0.0 之前,嵌套类支持有限。嵌套类被视为不透明指针。但是,在这些旧版本中有一个嵌套类支持的解决方法,要求用户在全局作用域中复制嵌套类,在全局作用域中为嵌套类添加 typedef,并在嵌套类上使用"嵌套解决方法"功能。这导致了与"平坦嵌套"特征大致相同的行为。由于 SWIG-3.0.0 中现在提供了适当的嵌套类支持,此功能已被弃用,不再需要更改代码。

因此,您应该使用 3.0 或更高版本来支持嵌套类。这将使您避免需要抑制任何内容,并且还可以解决其他问题。

我刚刚遇到了同样的python问题。当我将3.0.12与嵌套类一起使用时,我只会看到警告:

Warning 325: Nested class not currently supported (Foo ignored)

所以我使用了以下功能:

   %module test
   %feature("flatnested", "1");
   %rename (Bar_Foo) Bar::Foo;
   class Foo {};
   class Bar {
    public:
    class Foo {};
   };

实际上,在我的问题中,我在需要它的特定情况下再次禁用了该功能(因为它引起了枚举类的麻烦(。

最新更新