0

I am having huge troubles with swig. I want to write a library in C++ to include it and use it as python extension. The problem is, that swig complains about additional includes, that it cannot find, when i use the following command:

swig -python -Isrc myModule.i

The output is as follows:

Error: unable to find 'forward_list'

and a few more that are specified in my interface file:

/* file: myModule.i */
%module myModule
%{
#include <forward_list>
#include <string>
#include <set>
#include "myModule.h"
%}

%include "myModule.h"
%include <forward_list>
%include <string>
%include <set>

I followed the intructions to incorporate additional directories and used the following command:

swig -python -I/usr/include/c++/5 -Isrc myModule.h

Then swig was complaining about missing files in

/usr/include/c++/5/bits

For example c++config.h. I have both c++-multilib and g++-multilib installed. However, these packages have been installed to another directory:

/usr/include/x86_64-linux-gnu/c++/5/bits

So I can decide now, if I want swig to find the necessary files by specifying -I to these, or to be able to find the includes, which are located in the other folder. What can I do or rather, what am I doing wrong?

  • Related: https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h –  Jan 31 '18 at 18:51
  • 2
    `` was added in C++11 check your compiler and compiler flags. see: http://en.cppreference.com/w/cpp/header – Richard Critten Jan 31 '18 at 18:52
  • That question linked is irrelevant here. the asker's not directly including parts of bits. I suspect this stems from not having C++11 enabled. – user4581301 Jan 31 '18 at 18:53

1 Answers1

0

It seems that I have simply forgotton to add the -c++ option in the command. This obviously lets swig know, that it is c++ code. The error messages concerning bits/<xy>.h are gone then.