1
我使用的是Windows 7(64),Ruby(Ruby200-x64)和swig(swigwin-2.0.10)。開始在Windows上使用SWIG-Ruby
我已經嘗試重新創建SWIG頁面中列出的一個簡單示例。 http://stuff.mit.edu/afs/athena/astaff/project/svn/src/swig-1.3.25/Examples/ruby/class/index.html
我按照從How to create a DLL with SWIG from Visual Studio 2010一步一步的程序修改它爲Ruby的情況。
當我生成項目的發佈版本,我得到一個錯誤
C:\Dev-Cpp\include\stddef.h(6): fatal error C1021: invalid preprocessor command 'include_next' .
另外,同時運行在Visual Studio實例2012,實施例從列表中(實施例/紅寶石/ SIMPLE)提供沉綿我已正確設置所有的環境變量,蔭得到以下錯誤:
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 : ')'
請幫助。我是SWIG的小菜一碟!謝謝 。
非常感謝!但現在我得到以下錯誤1> example_wrap.cxx(1119):錯誤C3861:'rb_obj_classname':標識符未找到 1> example_wrap.cxx(1341):錯誤C4430:缺少類型說明符 - int假定。注意:C++不支持default-int 1> d:\ ruby \ lib \ ruby \ 1.6 \ i586-mswin32 \ config.h(4):參見以前定義的'inline' 1> C:\ Program Files (x86)\ Microsoft Visual Studio 11.0 \ VC \ include \ xkeycheck.h(238):warning C4005:'volatile':宏重新定義 VC \ include \ xkeycheck.h(242):致命錯誤C1189:#error:C++標準庫禁止宏觀化關鍵字。 –
您的C++類示例是否自行編譯?我不知道Ruby或安裝它,但問一個新的問題,併發佈一個完整的,最小的例子(.i,.cpp,.h,swig和編譯命令),有人可以編譯重現錯誤,我肯定有人可以回答。 –
好的謝謝馬克。 –