Following a very-well written post on stackoverflow, getting QT and Ruby running on Windows 7 is quite easy nowadays.
Quote from http://stackoverflow.com/questions/7577248/how-can-i-get-qt4-running-with-ruby-1-9-2-on-windows-7:
The following steps work on Windows 7:
- Install Ruby 1.9.2 via the official download page.
- In a Windows shell, run
gem install qtbindings.
The trivial example (
require 'rubygems'; require 'Qt') should now work.
Hence the tutorial below is now obsolete. However, I will keep it here for reference purposes.
This is an update on a previous tutorial which explained how to write Ruby applications using Qt on Windows XP. This new version is dealing with Ruby applications using Qt on Windows 7 (but it should also work in Windows XP). Also, it uses Qt 4.6.1 instead of Qt 4.3.4 and it also brings a newer version of QtRuby (2.1.0).
——RANT MODE: ON—–
Believe it or not: In some QtRuby application I wrote some time ago, somebody discovered a “hidden feature” (let’s not use the b-word here). To remove this “feature” I had to re-install my development environment since in the meantime I got a new laptop (really fancy one with SSD and all, I like it).
Three years ago, getting QtRuby running on Windows was so complicated that it was worth a lengthy tutorial.
But now it’s 2011. Should be much better now, right?
Turns out, in June 2011 it is so complicated, that dr1ku wrote an even longer tutorial (no bashing indented, his article is really exhaustive with a lot of insight and information).
Today it is my turn again. Luckily I found a solution that is reasonably simple, but still requires some not-too-obvious steps (at least for a ruby-noob like myself).
So. Here we go again. I wonder what it will be like in 2014.
Oh wait, the end of the world is scheduled for 2012. Phew, that will save us some trouble.
——RANT MODE: OFF—–
As in the previous installment of this guide, I did not use the latest versions of Ruby/Qt/QtRuby, because they simply don’t work together (as dr1ku points out in his post mentioned above). I will assume that Ruby is not yet installed on your system.
- Download and install Ruby 1.8.7-p334.
Make sure to use the RubyInstaller version. You can find it at rubyforge.During installation, make sure to add ruby to your path.
Verify the installation by opening a command line and type
ruby --version. It should yield:
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
- Update gems to the latest version by typing
gem update --system
- Install rake (which is a prerequisite for QtRuby)
gem install rake
- Install DevKit (which is a prerequisite for QtRuby)
Follow the instructions found here.
Don’t panic: The instruction looks lengthy, but most of the steps are optional or for updating legacy versions of DevKit.
- Finally install QtRuby gem. On the command line type
gem install qtruby4 --remote --platform=mswin32
--platform=mswin32is required to override the platform check of gems.
- Verify the installation by opening a command line and type
irb(an interactive ruby interpreter)
require 'rubygems'and hit enter. It should yield
require 'Qt'which should also yield
Well, that’s it. For getting-started instructions and some more information, please visit the previous installment of this guide and start reading after “That’s it!”
——RANT MODE: ON—–
Where was I? Oh right, that “hidden feature” is still hiding…
——RANT MODE: OFF—–
Pingback: ThisIsNotATest » Blog Archive » Getting Qt and Ruby (=QtRuby) running on Windows XP
Howdy. I really wanted to get the latest version of Ruby running with Qt, so I did some digging, and it turns out things are even simpler now. It’s a two step process!
1. Install Ruby
2. Run “gem install qtbindings”
I documented my odyssey here: http://stackoverflow.com/questions/7577248/how-can-i-get-qt4-running-with-ruby-1-9-2-on-windows-7
Just thought you might like to know!
Thanks for the information and for the great post on stackoverflow. I updated my tutorial with a reference to your article.
Let’s hope it stays that simple.