I am attempting to compile a C++ extension for python.
I have created an interface file foo.i which looks like this:
%module foo
%include "typemaps.i" // For pointers to primitive types
%include "std_string.i" // std::string mapping
%apply const std::string& {std::string* foo}; // data types containing std::string members
%{
#define SWIG_FILE_WITH_INIT
#include "../path/to/c++/header/files/foo_header.h"
%}
%apply double *OUTPUT { double *p, double *p2, double *p3 };
%apply double *OUTPUT { double *a1, double *a2, double *a3 };
%apply double *OUTPUT { double *a, double *b };
class FooBar
{
/*
method signatures etc ...
*/
};
The warning is issued when the class keyword is encountered. Further on in the class declaration, a C++ keyword (bool) is encountered in one of the method signatures, and at which point SWIG barfs.
I can't see anything in the docs that states that (how?) SWIG should be informed that the files being parsed are C++ - as a matter of fact, IIRC, in the documentation, we are told that SWIG is able to deduce whether a file is C/C++ from the headers alone - so what's going on?
Incidentally, I am using SWIG Version 2.0.4
You need to call SWIG with -c++
when you call it if you're using C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With