0

Hello everyone,

I am a newbie (started learning ruby 3 weeks ago) :icon_redface:
and I can not get out from this comiling error.

when I try to run this sample program:

#!/usr/bin/ruby

# ZetCode Ruby GTK tutorial
#
# This program centers a window on
# the screen
#
# author: jan bodnar
# website: [url]www.zetcode.com[/url]
# last modified: April 2009

require 'rubygems'
require 'gtk2'

class RubyApp < Gtk::Window
    def initialize
        super

        set_title "Center"
        signal_connect "destroy" do
            Gtk.main_quit
        end

        set_default_size 250, 200
        set_window_position Gtk::Window::POS_CENTER

        show
    end
end

Gtk.init
    window = RubyApp.new
Gtk.main

I get error :

/home/giovi/NetBeansProjects/center/lib/main.rb:12:in `require': no such
file to load -- gtk2 (LoadError)
from /home/giovi/NetBeansProjects/center/lib/main.rb:12

Does anyone now why?

Thank you for your help, regards
Giovanni

Edited by __avd: Added [code] tags.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by gioe
0

Thank you xml_looser! that worked.

I typed "gem install gtk2" in a terminal session
and I am now able to run the program above in irb
(typing it line by line).
Unfortunatly the program doesn't run in Netbeans.
I get the same error described above.
I guess there are some settings in Netbeans who
let him read gems (hence gtk2).
Any suggestions about that?
Thank you in advance!

OS : Ubuntu 10.04 (Lucid Lynx)
Ruby : 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.