Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 302
Kaushik Koneru Avatar asked Oct 18 '13 09:10

Kaushik Koneru


2 Answers

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

like image 166
bluedog Avatar answered Nov 15 '22 00:11

bluedog


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"
like image 28
Mark Tolonen Avatar answered Nov 15 '22 00:11

Mark Tolonen