swig转换时遇到的问题,进行记录
Syntax error in input.
如果源代码里有__declspec(dllexport)
,就会出现这个错误。
这是因为__declspec(dllexport)
不是标准c++语法
SWIG只解析ISO C/C++ 所以无法处理__declspec(dllexport)
解决方法: 在.i文件的开始里添加%include <windows.i>
There is a Windows interface file, windows.i, to deal with these
calling conventions though. The file also contains typemaps for
handling commonly used Windows specific types such as __int64, BOOL,
DWORD etc. Include it like you would any other interface file
swig\Lib\swigwarnings.swg(39) : Error: Unable to find ‘swigwarn.swg’
编译.i文件时提示,没有swigwarn.swg这个文件。
但是在运行示例的时候有???没有这个报错???
查找在示例的目录下,(我的工程和示例是两个不一样的目录)
说明这个文件是自己生成的 ,而不在github上也不在下载的压缩包中。
解决办法:swigwarn.swg找到后,放入到自己项目的目录下。即可。