I am using RHEL 6 and trying to compile some code using SWIG.
The SWIG file is named mySwig.i and looks like
%module base_module
%{
#include "base.h"
%}
%include "base.h"
The mySwig.i file is kept in a folder named foo. The folder foo also has other .h, .c and .cxx files.
The command I use is
gcc -fpic -c foo/*
The output is:
foo/mySwig.i:1 error: expected identifier or '(' before '%' token
foo/mySwig.i:3 error: stray '#' in program
foo/mySwig.i:5 error: expected identifier or '(' before '%' token
Does anyone have any ideas how to resolve these errors? You can't compile the SWIG specification file as a C++ source file! You need to convert it first to a source file with a special program. On another note, you tagged this question C++, but you use gcc to compile instead of e.g. g++.
以上就是Error: Stray '#" in program (SWIG)的详细内容,更多请关注web前端其它相关文章!