0

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'
kleif
  • 1
  • Install a gem that provides fox, or remove the `require 'fox'` line from your Ruby application. – Todd A. Jacobs Apr 08 '18 at 18:51
  • i did what you said and removed the require 'fox' line but then this comes up .rb:3:in `
    ': uninitialized constant Fox (NameError)
    – kleif Apr 08 '18 at 18:58
  • Of course, because you're using a class without the code that provides it. You need to install whatever gem or Ruby module provides your Fox class before you can use it. – Todd A. Jacobs Apr 08 '18 at 19:10
  • The problem is solved and it works now thanks for your Help. – kleif Apr 08 '18 at 19:46
  • 2
    @kleif consider closing the question if you resolved this issue, or if you feel the steps to resolution would be useful to share post a self-answer so others can see what you did – Simple Lime Apr 08 '18 at 20:01

1 Answers1

1

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
samu22
  • 11
  • 3