gpt4 book ai didi

c++ - Windows 上的 SWIG-Ruby 入门

转载 作者:太空宇宙 更新时间:2023-11-04 11:49:23 28 4
gpt4 key购买 nike

我正在使用 Windows 7 (64)、Ruby(Ruby200-x64) 和 swig(swigwin-2.0.10)。

我尝试重新创建 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 中运行示例时,示例 (Examples/Ruby/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 的菜鸟!谢谢。

最佳答案

链接中的示例是 C++,但错误消息表明 SWIG 在没有 -c++ 标志的情况下运行。 SWIG 包装器称为 example_wrap.c 而不是 example_wrap.cxx

尝试将该开关添加到 SWIG 命令行。

关于c++ - Windows 上的 SWIG-Ruby 入门,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18955348/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com