{"id":43,"date":"2011-06-20T22:54:01","date_gmt":"2011-06-20T20:54:01","guid":{"rendered":"http:\/\/tom.paschenda.org\/blog\/?p=43"},"modified":"2011-10-16T18:39:25","modified_gmt":"2011-10-16T16:39:25","slug":"getting-qt-and-ruby-qtruby-running-on-windows-7-and-windows-xp","status":"publish","type":"post","link":"https:\/\/tom.paschenda.org\/blog\/?p=43","title":{"rendered":"Getting Qt and Ruby (=QtRuby) running on Windows 7 (and Windows XP)"},"content":{"rendered":"<p><strong>Update 2011-10-16: <\/strong><br \/>\nFollowing a <a href=\"http:\/\/stackoverflow.com\/questions\/7577248\/how-can-i-get-qt4-running-with-ruby-1-9-2-on-windows-7\">very-well written post on stackoverflow<\/a>, getting QT and Ruby running on Windows 7 is quite easy nowadays.<\/p>\n<p>Quote from <a href=\"http:\/\/stackoverflow.com\/questions\/7577248\/how-can-i-get-qt4-running-with-ruby-1-9-2-on-windows-7\">http:\/\/stackoverflow.com\/questions\/7577248\/how-can-i-get-qt4-running-with-ruby-1-9-2-on-windows-7<\/a>:<\/p>\n<blockquote><p> The following steps work on Windows 7:<\/p>\n<ol>\n<li>Install Ruby 1.9.2 via <a href=\"http:\/\/rubyinstaller.org\/downloads\" rel=\"nofollow\">the official download page<\/a>.<\/li>\n<li>In a Windows shell, run <code>gem install qtbindings<\/code>.<\/li>\n<\/ol>\n<p>The trivial example (<code>require 'rubygems'; require 'Qt'<\/code>) should now work.<\/p><\/blockquote>\n<p>Hence the tutorial below is now obsolete. However, I will keep it here for reference purposes.<\/p>\n<p>\u2014\u2014OUTDATED TUTORIAL\u2014\u2013<\/p>\n<p>This is an update on a <a href=\"http:\/\/tom.paschenda.org\/blog\/?p=38\">previous tutorial<\/a> 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).<\/p>\n<p>\u2014\u2014RANT MODE: ON\u2014\u2013<\/p>\n<p>Believe it or not: In some QtRuby application I wrote some time ago, somebody discovered a &#8220;hidden feature&#8221; (let&#8217;s not use the b-word here). To remove this &#8220;feature&#8221; 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).<\/p>\n<p>Three years ago, getting QtRuby running on Windows was so complicated that it was worth a lengthy\u00a0 tutorial.<br \/>\nBut now it&#8217;s 2011. Should be much better now, right?<br \/>\nTurns out, in June 2011 it is so complicated, that dr1ku wrote an <a href=\"http:\/\/dr1ku.posterous.com\/qt-461-ruby-187-on-win32\">even longer tutorial<\/a>\u00a0 (no bashing indented, his article is really exhaustive with a lot of insight and information).<br \/>\nToday 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).<\/p>\n<p>So. Here we go again. I wonder what it will be like in 2014.<br \/>\nOh wait, the end of the world is scheduled for 2012. Phew, that will save us some trouble.<\/p>\n<p>\u2014\u2014RANT MODE: OFF\u2014\u2013<\/p>\n<p>As in the<a href=\"http:\/\/tom.paschenda.org\/blog\/?p=38\"> previous installment of this guide<\/a>, I did not use the latest versions of Ruby\/Qt\/QtRuby, because they simply don&#8217;t work together (as dr1ku points out in his post mentioned above). I will assume that Ruby is not yet installed on your system.<\/p>\n<ol>\n<li>Download and install Ruby 1.8.7-p334.<br \/>\nMake sure to use the RubyInstaller version. You can find it at <a href=\"http:\/\/rubyforge.org\/frs\/download.php\/74293\/rubyinstaller-1.8.7-p334.exe\">rubyforge<\/a>.During installation, make sure to add ruby to your path.<br \/>\nVerify the installation by opening a command line and type <code>ruby --version<\/code>. It should yield:<br \/>\n<code>ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]<\/code><\/li>\n<li> Update gems to the latest version by typing<br \/>\n<code>gem update --system<\/code><\/li>\n<li>Install rake (which is a prerequisite for QtRuby)<br \/>\n<code>gem install rake<\/code><\/li>\n<li>Install DevKit (which is a prerequisite for QtRuby)<br \/>\nFollow the instructions found <a href=\"https:\/\/github.com\/oneclick\/rubyinstaller\/wiki\/Development-Kit\">here<\/a>.<br \/>\nDon&#8217;t panic: The instruction looks lengthy, but most of the steps are optional or for updating legacy versions of DevKit.<\/li>\n<li>Finally install QtRuby gem. On the command line type<br \/>\n<code>gem install qtruby4 --remote --platform=mswin32<\/code><br \/>\nThe <code>--platform=mswin32<\/code> is required to override the platform check of gems.<\/li>\n<li>Verify the installation by opening a command line and type <code>irb<\/code> (an interactive ruby interpreter)<br \/>\nType <code>require 'rubygems'<\/code> and hit enter. It should yield <code>true<\/code>.<br \/>\nNow type <code>require 'Qt'<\/code> which should also yield <code>true<\/code>.<\/li>\n<\/ol>\n<p>Well, that&#8217;s it. For getting-started instructions and some more information, please visit the<a href=\"http:\/\/tom.paschenda.org\/blog\/?p=38\"> previous installment of this guide<\/a>\u00a0 and start reading after &#8220;That&#8217;s it!&#8221;<\/p>\n<p>\u2014\u2014RANT MODE: ON\u2014\u2013<\/p>\n<p>Where was I? Oh right, that &#8220;hidden feature&#8221; is still hiding&#8230;<\/p>\n<p>\u2014\u2014RANT MODE: OFF\u2014\u2013<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 2011-10-16: 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 &#8216;rubygems&#8217;; require &#8216;Qt&#8217;) should [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3],"tags":[],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-ruby","category-software-development"],"_links":{"self":[{"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43"}],"version-history":[{"count":0,"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions"}],"wp:attachment":[{"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tom.paschenda.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}