使用 wxRuby 的问题

发布于 2024-11-03 16:41:50 字数 1120 浏览 4 评论 0原文

我正在尝试使用 wxRuby 创建我的第一个 GUI。我安装了wxRuby(使用gem install wxruby-ruby19),并且似乎安装正常。我直接从 wxRuby 站点复制了一些代码。这是我使用的代码:

test.rb

require "wx"
include Wx

class MinimalApp < App
  def on_init
    Frame.new(nil, -1, "The Bare Minimum").show()
  end
end

MinimalApp.new.main_loop

当我运行它时,我得到了这个错误:

<internal:lib/rubygems/custom_require>:29:in `require': libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /usr/local/ruby/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-linux/lib/wxruby2.so (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-linux/lib/wx.rb:12:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from test.rb:2:in `<main>'

我以为它说 wxruby 不在那个目录中,但我检查了一下,它是,所以我不确定问题是什么。如果有人能提供帮助,那就太好了。

I am trying to create my first GUI using wxRuby. I installed wxRuby (using gem install wxruby-ruby19) and, it seemed to be installed alright. I copied some code directly from the wxRuby site. Here is the code I used:

test.rb

require "wx"
include Wx

class MinimalApp < App
  def on_init
    Frame.new(nil, -1, "The Bare Minimum").show()
  end
end

MinimalApp.new.main_loop

When I ran it, I got this error:

<internal:lib/rubygems/custom_require>:29:in `require': libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /usr/local/ruby/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-linux/lib/wxruby2.so (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-linux/lib/wx.rb:12:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from test.rb:2:in `<main>'

I thought it was saying that wxruby wasn't in that directory, but I checked and it was, so I'm not sure what the problem is. If anyone could help, that would be awesome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

诺曦 2024-11-10 16:41:50

我尝试了同样的事情并得到了同样的结果。

结果发现有 2 个 wxRuby gem。如果您使用 Ruby 1.9x,则需要 wxRuby-ruby19。 (gem 安装 wxruby-ruby19)。

我卸载了第一次安装的wxruby gem(gem uninstall wxruby),然后安装了适合我的Ruby版本的gem(gem install wxruby-ruby19)。瞧!所有示例代码都可以正常工作。无需额外下载。

I tried the same thing and got the same result.

It turns out that there are 2 wxRuby gems. If you are using Ruby 1.9x, you want wxRuby-ruby19. (gem install wxruby-ruby19).

I uninstalled the wxruby gem that I installed the first time (gem uninstall wxruby), and then installed the gem for my version of Ruby (gem install wxruby-ruby19). And Voila! All the sample code just worked. No additional downloads needed.

固执像三岁 2024-11-10 16:41:50

要使用wxRuby,您需要安装wxWidgets(在您的情况下是wxGTK)。
问题是wxRuby 使用wxWidgets 共享库(例如libwx_gtk2u_stc-2.8.so.0)并且找不到它们。

To use wxRuby you need wxWidgets installed (wxGTK in your case).
The problem is wxRuby uses the wxWidgets shared libraries (e.g. libwx_gtk2u_stc-2.8.so.0) and it cant find them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文