[CMake] SWIG syntax errors

Adam A Smith aasmith at cs.wisc.edu
Mon Jun 8 04:03:52 EDT 2009


On Sun, 7 Jun 2009, Mathieu Malaterre wrote:

> On Sat, Jun 6, 2009 at 2:19 AM, Adam A Smith<aasmith at cs.wisc.edu> wrote:
>> I'm curious if someone has run into this before:
>>
>> I'm using CMake to make some SWIG .i files.  I then use SWIG on those files,
>> and it tells me that I have a syntax error.  (I don't know SWIG syntax that
>> well, but I'm learning.)  I thought I'd ask all of you if this is something
>> you were familiar with.
>>
>> Details:
>>
>> There are several .cpp files in the C++ library I'm trying to translate to
>> Perl, Python, etc.  (Doesn't matter what language I specify--the same error
>> comes up.)  For example, I might tell it:
>>
>> $ swig -c++ -perl5 TextTools.cpp.i
>>
>> and get this error:
>>
>> TextTools.cpp.i:49: Error: Syntax error in input(1).
>>
>> The .i file made from each .cpp file differs, of course.  But the syntax
>> error is always here:
>>
>> namespace std __attribute__ ((__visibility__ ("default"))) {
>> # 245 "/usr/include/c++/4.3/i486-linux-gnu/bits/c++config.h" 3
>> }
>>
>> SWIG lists the first line (namespace std ...) as being the one with the
>> error.  (So in my above example, that's line 49.)
>>
>> Does anybody have an idea?
>
> this is clearly a question for the swig mailing list, right ?
>
> anyway I would add the following in my swig interface file:
>
> #define  __attribute__(x)
>
> 2cts
> -- 
> Mathieu
> Ps: I am pretty sure this is not the root of the problem, you should
> check the very begining of the errors reported...
>

Thanks for the reply. :)

Yes, I asked the SWIG mailing list as well.  But I was wondering if 
perhaps it was a bug in the CMake output, since the code in the .i file 
doesn't compile at all.  My main question (on this mailing list) wasn't so 
much "Can somebody fix this?" as "Has anybody seen such a problem before?"

Regardless, I sent the *complete* set of error messages.  There's just 
this single syntax error.

Thank you,
Adam


More information about the CMake mailing list