C++ 为覆盖std::exception的库生成swig接口时出错

C++ 为覆盖std::exception的库生成swig接口时出错,c++,swig,C++,Swig,我试图为一个库生成一个swig接口,该库有一个从std::exception继承的类。我似乎无法让它工作 这里有一个简单的例子。mylib.h的代码: #pragma once #include <exception> class CustomException : public std::exception { }; 正如您在mylib.i中的注释中所看到的,swig似乎很难弄清楚什么是std::exception。使用%include: %模块测试 %包括 %内联%{ 类

我试图为一个库生成一个swig接口,该库有一个从
std::exception
继承的类。我似乎无法让它工作

这里有一个简单的例子。mylib.h的代码:

#pragma once

#include <exception>

class CustomException : public std::exception
{

};
正如您在
mylib.i
中的注释中所看到的,swig似乎很难弄清楚什么是
std::exception

使用
%include

%模块测试
%包括
%内联%{
类CustomException:public std::exception
{
};
%}
%module mylib
 %{
 #include "mylib.h"
 %}

/*
Run without anything:
mylib.h:5: Warning 401: Nothing known about base class 'std::exception'. Ignored.
*/

/*
Run with: %include <exception>
mylib.i:11: Error: Unable to find 'exception'
*/

/*
Run with: %include exception.i 
mylib.h:5: Warning 401: Nothing known about base class 'std::exception'. Ignored.
*/

%include "mylib.h"
%module test
%include <std_except.i>
%inline %{
class CustomException : public std::exception
{
};
%}