【发布时间】:2016-02-27 18:26:19
【问题描述】:
我正在尝试运行此脚本并且我正在使用 Coderunner 2
require 'rubygems'
require 'gosu'
class Ball
def initialize(the_window)
@x = 200
@y = 200
@w = 20
@h = 20
@image = Gosu::Image.new(the_window, "ball.png", false)
end
def draw
@image.draw(@x, @y , 1)
end
end
class GameWindow < Gosu::Window
def initialize
super 800,600, false
self.caption = "Paddle Game"
@ball = Ball.new(self)
end
def update
end
def draw
@ball.draw
end
end
window = GameWindow.new
window.show
**
它会返回一条错误消息:
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require':
cannot load such file -- gosu (LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from paddle_game.rb:2:in `<main>'
我已经安装了 Ruby 2.0.0 和 gems...当我尝试安装 gosu 这是我得到的错误:
Mac-Users-iMac-763:~ macuser$ sudo gem install gosu
Building native extensions. This could take a while...
ERROR: Error installing gosu:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.4/ext/gosu
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r . /siteconf20151124-93492-9a029w.rb extconf.rb
The Gosu gem requires some libraries to be installed system-wide.
See the following site for a list:
https://github.com/jlnr/gosu/wiki/Getting-Started-on-OS-X
creating Makefile
current directory: /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.4/ext/gosu
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.4/ext/gosu
make "DESTDIR="
compiling stb_vorbis.c
compiling gosu_wrap.cxx
compiling Audio-Audio.cpp
compiling Bitmap-Bitmap.cpp
compiling Bitmap-BitmapIO.cpp
compiling DirectoriesUnix.cpp
compiling FileUnix.cpp
compiling Graphics-BlockAllocator.cpp
compiling Graphics-Color.cpp
compiling Graphics-Graphics.cpp
compiling Graphics-Image.cpp
compiling Graphics-LargeImageData.cpp
compiling Graphics-Macro.cpp
compiling Graphics-Resolution.cpp
compiling Graphics-ResolutionApple.cpp
compiling Graphics-TexChunk.cpp
compiling Graphics-Texture.cpp
compiling Graphics-Transform.cpp
compiling Input-Input.cpp
compiling Input-TextInput.cpp
compiling Inspection.cpp
compiling IO.cpp
compiling Math.cpp
compiling Text-Font.cpp
compiling Text-Text.cpp
compiling Text-TextApple.cpp
compiling TimingApple.cpp
compiling Utility.cpp
compiling UtilityApple.cpp
compiling Window.cpp
linking shared-object gosu.bundle
clang: error: unknown argument: '-multiply_definedsuppress'
make: *** [gosu.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.4
for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-
13/2.0.0/gosu-0.10.4/gem_make.out
我已尝试研究并提出不同的建议,但目前无法进一步了解。只是想知道我可能做错了什么,或者我是否应该使用其他编辑器?不知道为什么“要求”对我不起作用。谢谢
【问题讨论】:
标签: ruby-on-rails macos terminal rubygems