2017-06-17 102 views
0

我最近在Windows OS 8.1(Surface Pro 2)上安装了Ruby 2.3和Gosu 2d游戏开发库。两者的安装都很快且成功。使用库我写了一个基本的程序(使用Sublime Text 3)意味着生成一个空白窗口。控制台继续在调试尽管我试图返回此错误消息:Gosu库与Windows 8.1不兼容(ruby 2.3)

C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- gosu.so (LoadError) 
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gosu-0.12.0-x64-mingw32/lib/gosu.rb:17:in `<top (required)>' 
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require' 
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require' 
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require' 
    from C:/Users/Kevin/Desktop/Clone/clone.rb:1:in `<main>' 
[Finished in 0.7s with exit code 1] 
[shell_cmd: ruby "C:\Users\Kevin\Desktop\Clone\clone.rb"] 
[dir: C:\Users\Kevin\Desktop\Clone] 
[path: C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Ruby24-x64\bin] 

下面是基本的程序中,我写道:>>>

require "gosu" 

class GameWindow < Gosu::Window 
    def initialize width=500, height=500, fullscreen=false 
     super 
     self.caption = "Clone" 
    end 

    def update 
    end 

    def draw 
    end 
end 

GameWindow.new.show 

< < <

我很新到一般的编程,所以我试图解释这个错误信息是徒劳的。我在OSX Sierra的MacBook上安装并使用了Gosu,并且所有的工作都像它应该那样,导致我相信问题与操作系统有关。我知道过去由于系统依赖性问题,Windows操作系统上的Gosu库存在多个问题,但是对这些问题的解决方案已被证明是无益的。有人可以向我解释这个错误信息吗? Gosu库可能与Windows操作系统8.1不兼容,或者在Windows上设置Gosu的步骤是否可以跳过?

我将不胜感激任何帮助,我可以得到。

回答

0

问题标题提到了Ruby 2.3,但是从错误消息看来,您似乎正在使用Ruby 2.4。 Gosu 0.12.0与Ruby 2.4不兼容,但是Gosu 0.12.1是。请运行gem update gosu并重试,这应该可以解决问题。