Forum: Ruby-Gnome 2 'require': no such file to load -- gtk2

B5ca62ae97c39c92da0db9a14f677e2c?d=identicon&s=25 Giovanni Alverà (giovi)
on 2011-01-11 19:34
Attachment: main.rb (511 Bytes)
Hello everyone,

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: www.zetcode.com
# last modified: April 2009

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? I looked up in Synaptic if package gtk2 is
installed
but I can not find it there.

Thanx for your help, regards
Giovanni
820308d5db420d7f0e1d0ba97e09f520?d=identicon&s=25 Grant McLean (Guest)
on 2011-01-11 21:10
(Received via mailing list)
On Tue, 2011-01-11 at 19:34 +0100, Giovanni Alverà wrote:
> file to load -- gtk2 (LoadError)
>         from /home/giovi/NetBeansProjects/center/lib/main.rb:12
>
> Does anyone now why? I looked up in Synaptic if package gtk2 is
> installed but I can not find it there.

You probably need to install the 'libgtk2-ruby' package.

Cheers
Grant
B55d9706b57e8d286a4f198daf2ac69c?d=identicon&s=25 Andrea Dallera (edwin_bolthar)
on 2011-01-12 10:51
(Received via mailing list)
Or, better, the gtk2 gem, with

sudo gem install gtk2

Andrea
B5ca62ae97c39c92da0db9a14f677e2c?d=identicon&s=25 Giovanni Alverà (giovi)
on 2011-01-12 17:24
Grant McLean wrote in post #974023:
> On Tue, 2011-01-11 at 19:34 +0100, Giovanni Alverà wrote:
>> file to load -- gtk2 (LoadError)
>>         from /home/giovi/NetBeansProjects/center/lib/main.rb:12
>>
>> Does anyone now why? I looked up in Synaptic if package gtk2 is
>> installed but I can not find it there.
>
> You probably need to install the 'libgtk2-ruby' package.
>
> Cheers
> Grant

I looked at package 'libgtk2-ruby' with Synaptic
and I already have it installed (libgtk2-ruby1.8).

Thank you anyway :)
B5ca62ae97c39c92da0db9a14f677e2c?d=identicon&s=25 Giovanni Alverà (giovi)
on 2011-01-12 17:26
Andrea Dallera wrote in post #974195:
> Or, better, the gtk2 gem, with
>
> sudo gem install gtk2
>
> Andrea

Thank you Andrea, but when I type what you
sad that's what I get..

giovi@ACERaspire5920G:~$ sudo gem install gtk2
[sudo] password for giovi:
sudo: gem: command not found
giovi@ACERaspire5920G:~$

confused :S
B5ca62ae97c39c92da0db9a14f677e2c?d=identicon&s=25 Giovanni Alverà (giovi)
on 2011-01-12 18:03
I get a bit on with it.

I uninstalled package ruby1.8  and installed
ruby1.8-dev instead (the first one is missing
a few important files as suggested in topic
http://railsforum.com/viewtopic.php?id=22116)

I then installed RubyGems (vers. 1.3.5) with Synaptic.

I finally typed in a terminal:

sudo gem install gtk2

and installation went fine.
Anyway when I compile the program the
error arises again.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.