我正在尝试在 C++ 库上使用 SWIG 2.0.4,我的 .i 文件中有以下内容:
%module coh
%{
#include "coherence/lang.ns"
#include "coherence/net/CacheFactory.hpp"
#include "coherence/net/NamedCache.hpp"
%}
%include "coherence/lang.ns"
%include "coherence/net/CacheFactory.hpp"
%include "coherence/net/NamedCache.hpp"
我痛饮它:
$ swig -c++ -ocaml -I/opt/coherence-cpp/include coh.i
但得到错误信息:
/opt/coherence-cpp/include/coherence/net/CacheFactory.hpp:31: Error: Syntax error in input(1)
该文件的第 31 行是:
using coherence::run::xml::XmlElement;
using
不支持关键字吗?是否有解决方法,或者我应该只编写自己的 C++ 包装器,然后 SWIG 来代替?谢谢!
更新:我决定编写自己的包装器(将来,从一开始就采用不同的方法)。