Search code examples
c++swiggnuradio

Error using swig: Syntax error in input(1)


I am rather new with swig and I am getting an error that I cannot find. The error is:

/home/investigador/OMICRON-GNURadio/gr-freqAdaptiveOFDM/swig/../include/freqAdaptiveOFDM/mapper.h:39: Error: Syntax error in input(1).

And the file where the error is is this:

#ifndef INCLUDED_FREQADAPTIVEOFDM_SIGNAL_FIELD_H
#define INCLUDED_FREQADAPTIVEOFDM_SIGNAL_FIELD_H

#include <freqAdaptiveOFDM/api.h>
#include <gnuradio/digital/packet_header_default.h>

namespace gr {
namespace freqAdaptiveOFDM {

class FREQADAPTIVEOFDM_API signal_field : virtual public digital::packet_header_default
{
public:
    typedef boost::shared_ptr<signal_field> sptr;
    static sptr make();

protected:
    signal_field();
};

} // namespace freqAdaptiveOFDM
} // namespace gr

#endif /* INCLUDED_FREQADAPTIVEOFDM_SIGNAL_FIELD_H */

The line where the error is found is the class FREQADAPTIVEOFDM_API line. Thanks in advance for the help!

By the way, my swig file is the following:

#define freqAdaptiveOFDM_API
#define DIGITAL_API

%include "gnuradio.i"
%include "freqAdaptiveOFDM_swig_doc.i"

%{
#include "freqAdaptiveOFDM/mapper.h";
#include "freqAdaptiveOFDM/signal_field.h"
%}

%include "gnuradio/digital/packet_header_default.h"

%include "freqAdaptiveOFDM/mapper.h"
%include "freqAdaptiveOFDM/signal_field.h"

GR_SWIG_BLOCK_MAGIC2(freqAdaptiveOFDM, mapper);

%template(signal_field_sptr) boost::shared_ptr<gr::freqAdaptiveOFDM::signal_field>;

%pythoncode %{
signal_field_sptr.__repr__ = lambda self: "<signal_field>"
signal_field = signal_field.make;
%}

Solution

  • Most likely this is because FREQADAPTIVEOFDM_API is not defined anywhere in your SWIG interface.

    Removing the wrongly capitalized

    #define freqAdaptiveOFDM_API
    

    and replacing it by

    #define FREQADAPTIVEOFDM_API
    

    At the top of your .i file ought to solve that safely.