Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swig: Syntax error in input(3)

Tags:

c

syntax

swig

./theheader.h:349: Error: Syntax error in input(3).

Offending line:

string read_gdbm(GDBM_FILE dbf, string key_str, bool show_err = gbls.verbose);

Any ideas?

like image 535
Awalias Avatar asked Aug 13 '13 15:08

Awalias


2 Answers

Typically, a syntax error in SWIG means that it can't understand the line in question (which can be annoying, because the line numbers don't follow macros such as %defines). So I suggest you check that string (should it be std::string? has it been defined?), GDBM_FILE (has it been defined? should it be in a namespace?) and maybe gbls.verbose (has it been defined?) make sense to SWIG. It may help to run swig with the -E option (be sure to redirect the stdout), find the corresponding line and search backward for each type involved. You may need to add some #includes.

Also check the previous line, to ensure you're not missing a semicolon, or something like that.

like image 65
Paul Price Avatar answered Nov 17 '22 21:11

Paul Price


As a side note, I've run into the same issue for different reasons: I was trying to use a vector < vector < double >>. Now the ">>" character sequence mustn't be used with templates according to the C++99 standard, hence the swig error message popped up. The solution was to simply add an extra space to separate them.

like image 4
Balint J. Toth Avatar answered Nov 17 '22 19:11

Balint J. Toth