Hi Kris

Thanks for correction. I did that thing also but it is also giving error. Lets have a look on my interface file i.e example.i

%module example
%{
#include "oaBuildDef.h"
#include "oaDesignDBTypesPvt.h"
#include "oaBoundary.inl"
#include "oaOccShapeV.h"
#include "oaBuildInfo.inl"
#include "oaGroup.inl"
#include "oaConstraintGroup.inl"
#include "oaDMEnumWrapper.inl"
#include "oaTechEnumWrapper.inl"
#include "oaDesignEnumWrapper.inl"
#include "oaTechDBTypesPvt.h"
#include "oaSegStylePvt.inl"
#include "oaBusTermDefPvt.inl"
#include "oaTextPvt.inl"
#include "oaClusterPvt.inl"
#include "oaBoundaryV.h"
#include "oaInstHeaderPvt.inl"
#include "oaVectorInstDefPvt.inl"
%}
%include "oaBuildDef.h"
%include "oaDesignDBTypesPvt.h"
%include "oaBoundary.inl"
%include "oaOccShapeV.h"
%include "oaBuildInfo.inl"
%include "oaGroup.inl"
%include "oaConstraintGroup.inl"
%include "oaDMEnumWrapper.inl"
%include "oaTechEnumWrapper.inl"
%include "oaDesignEnumWrapper.inl"
%include "oaTechDBTypesPvt.h"
%include "oaSegStylePvt.inl"
%include "oaBusTermDefPvt.inl"
%include "oaTextPvt.inl"
%include "oaClusterPvt.inl"
%include "oaBoundaryV.h"
%include "oaInstHeaderPvt.inl"
%include "oaVectorInstDefPvt.inl"

My some header files are in some other folder so I included in command line.

swig   -I/path/source/sc/build    -I/path/source/sc/base  example.i

Error I am getting is oaDesignDBTypesPvt.h:54: Error: Syntax error in input(1).

Then I did like what you have said swig   -I/path/source/  example.i, instead of giving two times I define path 2 directories back. But still I am getting same error.

I also tried to include path in interface file like #include "path/file.h", but again same error.

All these files are part of API's and I checked those by compiling and are working fine.

Please give some suggestion.

Regards
Varun


On Thu, Oct 17, 2013 at 12:48 PM, Kris Thielemans <kris.f.thielemans@gmail.com> wrote:
Hi Varun

You had a mistake in your answer. You typed

swig  -I/<somepath>/myProject/common/com.h"  interface.i

instead, it has some be something like

swig  -I/<somepath>/  interface.i

that is, the -I flag specifies a "prefix path" where swig can find the files
for any  %include statements. When swigging an API, clearly it's best to use
the same convention for this prefix path as the API does in its own include
files. So, the above line assumes that the API tells you to use

#include "myProject/common/com.h"

in your C++ code. Another way to look at it is to say that swig's -I flag
has to be the same as the one you pass to the C++ compiler.

HTH
Kris

> -----Original Message-----
> From: Varun Gupta [mailto:varun06gupta@gmail.com]
> Sent: 17 October 2013 03:47
> To: pluto mars
> Cc: swig-user@lists.sourceforge.net
> Subject: Re: [Swig-user] Regarding interface file for swig
>
> Hi Pluto
>
>
> Yes my question is also same. You can include header file like
>
> %{
>
> #include "a.h"
>
> #include "<somepath>/myProject/common/com.h"
>
> %}
> %include "a.h"
> %include "<somepath>/myProject/common/com.h"
>
>
> or you can try command line option like
>
>
>  swig  -I/<somepath>/myProject/common/com.h"  interface.i
>
>
> Hope it works for you
>
>
> I am working on API's which has so many header files so I guess that's why
I
> am getting some errors.
>
>
> Regards
>
> Varun
>
>
> On Thu, Oct 17, 2013 at 12:28 AM, pluto mars <plutomars955@gmail.com>
> wrote:
>
>
>       HI,
>
>
>       I think I have a similar question.suppose I have an interface file
in the
> following folder:
>
>
>       <somepath>/myProject/module/interface.i
>
>
>       let say I have an include file in the same folder
>       <somepath>/myProject/module/a.h
>       <somepath>/myProject/module/a.c
>
>
>       Now in the interface.i I can add something like %include "a.h"
>
>
>       But lets say I have another header file in another folder in
myProject;
>       <somepath>/myProject/common/com.h
>       <somepath>/myProject/common/com.c
>
>
>       Now how do I add the com.h header in my interface.i file ?
>
>
>       Varum is this also your question ?
>
>
>       Thanks for answering
>
>
>       pluto mars
>
>
>
>       On Wed, Oct 16, 2013 at 12:26 PM, Toivo Henningsson
> <toivo.henningsson@modelon.com> wrote:
>
>
>               I'm not sure that I really understand your problem. What
kind
> of error message do you get, and when doing what?
>
>                / Toivo
>
>               > From: Varun Gupta [mailto:varun06gupta@gmail.com]
>               > Sent: den 16 oktober 2013 10:52
>               > To: Toivo Henningsson
>               > Cc: swig-user@lists.sourceforge.net
>               > Subject: Re: [Swig-user] Regarding interface file for swig
>
>               >
>               > Thanks for the information. This thing I tried but it also
not
> getting header files. Do I need to add something in interface file also
like
> %import ...........? I am having some 20 header files to include which are
in
> some 5 different folders at different locations. > Can you please explain
with
> some example.
>               > Regards
>               > Varun
>               >
>               > On Wed, Oct 16, 2013 at 1:44 PM, Toivo Henningsson
> <toivo.henningsson@modelon.com> wrote:
>               > > From: varungupta [mailto:varun06gupta@gmail.com]
>               > > Sent: den 16 oktober 2013 09:12
>               > > To: swig-user@lists.sourceforge.net
>               > > Subject: [Swig-user] Regarding interface file for swig
>               > >
>               > > Hello I am beginner for swig. I am trying to generate
> python wrapper for C++ API's. I tried with simple C++ code and it was
> working fine. Then I started working on API's and when I tried to create a
> python wrapper for a single API ( by placing all the  headers in the
interface
> file), I got an error saying that some .h files are missing. I found out
that the
> some header files are in some other folder. Please let me know how it is
> possible to add a header file present in a different folder into the
interface
> file by writing some loops, conditions etc. Please suggest. Regards Varun
>
>               > You can use the -I (capital i) command line option to SWIG
> to specify include directories. Command line options are documented at
> http://www.swig.org/Doc2.0/SWIG.html#SWIG_nn2
>
>               > Hope that helps,
>               > Toivo
>
>               This email and any attachments are intended solely for the
> use of the individual or entity to whom it is addressed and may be
> confidential and/or privileged. If you are not one of the named recipients
or
> have received this email in error, (i) you should not read, disclose, or
copy it,
> (ii) please notify sender of your receipt by reply email and delete this
email
> and all attachments, (iii) Modelon does not accept or assume any liability
or
> responsibility for any use of or reliance on this email.
>
>
>
--------------------------------------------------------------------------
> ----
>               October Webinars: Code for Performance
>               Free Intel webinars can help you accelerate application
> performance.
>               Explore tips for MPI, OpenMP, advanced profiling, and more.
> Get the most from
>               the latest Intel processors and coprocessors. See abstracts
> and register >
>
>       http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140
> /ostg.clktrk
>               _______________________________________________
>               Swig-user mailing list
>
>               Swig-user@lists.sourceforge.net
>               https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
>