Ruby require Fox Error on Ubuntu

123 Views Asked by At

When I want to run my .rb file on Terminal this comes up the whole time:

/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fox (LoadError)
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
1

There are 1 best solutions below

0
On

Possibly it's due to the wrong name. You cannot require Fox, since it is a Module. In ruby you include Modules.

Good syntax:

include Fox

If you wanna require something from Fox libraries, (what is highly recommended :D), you should require the 'fox16' library.

Here is a basic window program:

require 'fox16'

include Fox

class Main < FXMainWindow
  
  def initialize(app)
    super(app, "Window", :width => 600, :height => 600)
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end
  
end

if __FILE__ == $0
  
  FXApp.new("Window") do |app|
    Main.new(app)
    app.create
    app.run
  end
  
end