majorpain1588
majorpain1588

Reputation: 349

SWIG Syntax Error

I'm trying to compile some SWIG bindings from a wireless communications library (http://www.yonch.com/wireless) that also uses the IT++ library. I am using SWIG version 2.0.11 on Ubuntu 14.04.

This is the error I am getting when trying to build:

/usr/include/itpp/base/binary.h:162: Error: Syntax error in input(1)

Here is line 162 from binary.h:

ITPP_EXPORT std::ostream &operator<<(std::ostream &output, const bin &inbin);

If the rest of that file is needed it can be found here: http://montecristo.co.it.pt/itpp/binary_8h_source.html

This is the SWIG command line call that is being used:

/usr/bin/swig -c++ -python -I/home/user/anaconda/include/python2.7 -I../../../include -I/usr/include -I../../../bindings/itpp -I../../../bindings/itpp/.. -DHAVE_CONFIG_H -o base_sparse.cpp ../../../bindings/itpp/base_sparse.i

I have almost no experience with SWIG and can't seem to see what about the code would be causing that syntax error. Any insights would be greatly appreciated!

Upvotes: 1

Views: 1374

Answers (1)

Jens Munk
Jens Munk

Reputation: 4725

Exports are not understood by SWIG

I usually add a

#define ITPP_EXPORT

in your .i file after the inclusion of the C/C++ headers and before you include them using

%include "Someheader.h"

Upvotes: 2

Related Questions