Narendra Kumar
Narendra Kumar

Reputation: 31

swig error: Extraneous #endif

When I executed the swig command on my .i file, I am getting an error on an include file.

The error says:

../include/example.h: Error: Extraneous #endif.

The contents of the example.h file is as below:

#ifndef EXAMPLE_H
#define EXAMPLE_H

namespace my_example {

class BaseExample {
public:
    virtual ~BaseExample() {}
};

}

#endif /* EXAMPLE_H */

In the above code, the #endif correctly matches with #ifndef. So, why is swig reporting "Extraneous #endif." ?

Upvotes: 1

Views: 1655

Answers (1)

Narendra Kumar
Narendra Kumar

Reputation: 31

I finally found the problem and solved it. I think, the file had BOM marks in the end of file. So, I executed :set nobomb

inside my vim editor, and the error went away.

Upvotes: 1

Related Questions