繁体   English   中英

Gosu库与Windows 8.1(Ruby 2.3)不兼容

[英]Gosu library incompatibility with windows 8.1 (ruby 2.3)

我最近在Windows OS 8.1(Surface Pro 2)上安装了Ruby 2.3和Gosu 2d游戏开发库。 两者的安装都是快速而成功的。 使用该库,我编写了一个用于生成空白窗口的基本程序(使用Sublime Text 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 OS上的Gosu库存在多个问题,但是事实证明,解决这些问题无济于事。 有人可以向我解释此错误消息吗? Gosu库是否可能与Windows OS 8.1不兼容,或者只是跳过了在Windows上设置Gosu的一个步骤?

我将不胜感激。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM