Hi everyone, I'm new to wxRuby. I installed using "gem install wxruby" and it installed version 2.0.1, along with ri and rdoc documentation. I try to test it in irb, but I get this message: [code] irb(main):001:0> require 'wx' LoadError: no such file to load -- wx from (irb):1:in `require' from (irb):1 [/code] I also get an error message if I write this code in a text editor: [code] require "wx" include Wx class MinimalApp < App def on_init Frame.new(nil, -1, "The Bare Minimum").show() end end MinimalApp.new.main_loop [/code] Produces this: [code] ./wx.rb:2: uninitialized constant Wx (NameError) from wx.rb:1:in `require' from wx.rb:1 [/code] I thought it had something to do with the wx_sugar gem so I uninstalled it using "gem uninstall wx_sugar", but the errors were still there. I am using Win XP Professional, and Ruby Installer 1.8.7. Please help!
on 2010-08-19 15:26
on 2010-08-19 16:25
I believe you have to require rubygems before you require wx
on 2010-08-19 17:15
Bruce Loving wrote: > I believe you have to require rubygems before you require wx Hi, I did as you suggested and got the following: NameError: uninitialized constant Wx from ./wx.rb:2 from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' This was using irb.
on 2010-08-19 17:22
Hi, I tried using Ruby Installer 1.8.6 and now it works (after requiring rubygems as you suggested). It seems wxruby is incompatible with the newer versions. They should put that in the tutorial. Anyhoop, thanks so much. Now I can begin programming GUI in Ruby!
on 2010-08-19 17:51
this works just fine for me. require 'rubygems' require 'wx' include Wx
on 2010-08-19 22:31
Heya Tuti, We provide a Installer program on our Projects page of RubyForge for Ruby 1.8.7, and wxRuby combined. The reason we have troubles with this, is cause the Ruby Installer project just went from MSVCRT compiler to the MINGW compiler. Different compilers have different methods in which to compile code, and export Library Routines, so binary extensions built for MSVCRT, isn't compatible with MINGW. The same holds true on Ubuntu systems. Ubuntu version 8.10 and before earlier use gcc 3.3, which is incompatible with Ubuntu version 9.04 onwards, which uses gcc 4.0. We have to use different builds for < 8.10 compared to > 9.04. The main cause of this, is RubyGems isn't very compiler aware, outside of the main compiler names, they don't allow for Compiler versions in the naming scheme. So we have to package things a bit differently. In most cases, when you try to install a binary Gem, it won't follow the compiler used, especially MINGW, as it just recently became popular with the adaptation of the Ruby One Click Installer project. You will find with our next wxRuby gem release, that it will be compiled for MINGW and GCC 4.0+. And then we'll have to provide deprecated versions for older GCC Versions. I don't know if we will still maintain a MSVCRT version for Windows, as that has not been decided yet. hth, Mario
on 2010-08-20 00:11
Thanks for the explanation Mario, > You will find with our next wxRuby gem release, that it will be compiled > for > MINGW and GCC 4.0+. And then we'll have to provide deprecated versions > for > older GCC Versions. I don't know if we will still maintain a MSVCRT > version > for Windows, as that has not been decided yet. > > hth, > > Mario I did not completely understand what you meant with this paragraph but I assume that you mean the next release will be compatible without requiring a separate build. I look forward to it. I do remember downloading a wx-ready ruby 1.9 installer from the wxRuby page in RubyForge a while back. Not sure if it's still available. But I didn't use it for long. Anyway, I'll check it out again. In the meantime, I'm happy with 1.8.6.