In SWIG compilation : In header file in interface is unable to resolve other header files.

蹲街弑〆低调 提交于 2019-12-07 06:52:10

问题


In interface File. I have included a header file.In that Header file there are many header files included but from top tree bases But in Swig is not able to recognize those

Eample:

main.h
#include<dir/second.h>
#define PAGE 1

Swig is unable to resolve that dir in the header file


回答1:


Use

-I<dir>

on the SWIG command line to tell SWIG about include paths it doesn't know about.

See SWIG 2.0 command line documentation




回答2:


SWIG normally does not process #include files recursively. The reason is you would not want SWIG to process every system header file. You can override this with -includeall, but that is probably not what you want. Instead, consider the following include file:

a.h

#include <stdio.h>
#include <stdlib.h>
#include "b.h"
#include "c.h"

For this, use the following .i file if you want the declarations in a.h, b.h and c.h to be exposed, but do not want the system header files processed:

%module example

%{
#include "a.h"
%}

%include "a.h"
%include "b.h"
%include "c.h"


来源:https://stackoverflow.com/questions/19446143/in-swig-compilation-in-header-file-in-interface-is-unable-to-resolve-other-hea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!