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:


# 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

        set_title "Center"
        signal_connect "destroy" do

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


    window = RubyApp.new

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

Recommended Answers

load by gemcutter the module gt2

see by version what you wanted

eg windos

install with gem
there are Runtime Dependencies
so must all install to used gtk2

Jump to Post

All 2 Replies

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]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.