SWIG_AsVal_wchar_t 未找到标识符

SWIG_AsVal_wchar_t identifier not found

我在使用 SWIG 和 wchat_t 类型时遇到了一些问题,为了重现这个问题,我得到了一点 MCVE here

问题是 SWIG_AsVal_wchar_t 被调用但未在任何地方定义。

我试过遵循已接受的答案here,但由于某些原因对我不起作用

我该如何解决这个问题?

PS:我也在 github

上发布了这个问题

为了使用 wchar_t,您可以包含接口 cwstring.i 而不是 wchar.i

这允许使用此修改后的 libsystem.i 构建您的示例:

%module libsystem
%include "cwstring.i" 
%{
#include "foo.h"
%}
%include "foo.h"

另一种方法是使用以下 libsystem.i 包含丢失的片段:

%module libsystem
%include "wchar.i"
%include <typemaps/wstring.swg> 
%{
#include "foo.h"
%}
%include "foo.h"