Question

I am using windows 7 (64) , Ruby(Ruby200-x64) and swig(swigwin-2.0.10) .

I have tried recreating a simple example listed in the SWIG Pages. http://stuff.mit.edu/afs/athena/astaff/project/svn/src/swig-1.3.25/Examples/ruby/class/index.html

I followed the step by step procedure from How to create a DLL with SWIG from Visual Studio 2010 modifying it for the case of Ruby .

When i build the release version of the project , I am getting an error

C:\Dev-Cpp\include\stddef.h(6): fatal error C1021: invalid preprocessor command 'include_next' .

Also while running examples in visual studio 2012,Example (Examples/Ruby/SIMPLE) from the list provided ,Eventhough I have set all the environment variables properly ,Iam getting the following error :

 1. 1> RUBY_INCLUDE:
    C:\Ruby200-x64\include\ruby-2.0.0;C:\Ruby200-x64\include\ruby-2.0.0\ruby;C:\ruby-1.8.7-p160;C:\ruby-1.8.6-p368;C:\ruby-1.8.7-p160\win32;C:\ruby-1.8.7-p160\vms;C:\ruby-1.8.7-p160\ext\nkf\nkf-utf8
    1> RUBY_LIB:
    C:\Ruby200-x64\lib\libx64-msvcrt-ruby200.dll.a;C:\Ruby200-x64\bin\x64-msvcrt-ruby200.dll;
    1> example_wrap.c
    1>c:\ruby200-x64\include\ruby-2.0.0\ruby/encoding.h(87): error
    C2146: syntax error : missing ')' before identifier 'obj'
    1>c:\ruby200-x64\include\ruby-2.0.0\ruby/encoding.h(87): error
    C2061: syntax error : identifier 'obj'
    1>c:\ruby200-x64\include\ruby-2.0.0\ruby/encoding.h(87): error
    C2059: syntax error : ';'
    1>c:\ruby200-x64\include\ruby-2.0.0\ruby/encoding.h(87): error
    C2059: syntax error : ')'

Please Help. I am a noob at SWIG ! Thanks .

Was it helpful?

Solution

The example from the link was C++, but the error message suggests SWIG was run without the -c++ flag. The SWIG wrapper was called example_wrap.c instead of example_wrap.cxx.

Try adding that switch to the SWIG command line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top