在 Windows 上为 ruby​​ 安装 ncurses

Fle*_*seo 5 ruby windows ncurses

我正在尝试在 Windows 上为 ruby​​ 安装 ncurses。我之前没有在我的机器上安装 ncurses。我认为拥有它所要求的“ruby devkit”就足够了,但现在我被要求指定选项......我不知道选择哪些选项,或者我是否需要做/安装其他东西要安装 gem:

C:\Ruby193\Devkit>gem install ncurses -- --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ncurses:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir
C:/Ruby193/lib/ruby/1.9.1/shellwords.rb:35:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError)
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:2216:in `<top (required)>'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from extconf.rb:22:in `<main>'


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1/./gem_make.out
Run Code Online (Sandbox Code Playgroud)

多么痛苦,我只想安装这个 gem,这样我就可以运行这个:

require 'curses'
cols = Curses.stdscr.maxx
msg = "random_string"
str = msg.center(msg.length + cols - msg.length - 5 - 3)
puts "<!-- #{str}-->"
Run Code Online (Sandbox Code Playgroud)

Cra*_*aig -1

ruby ncurses gem 要求在计算机上安装 ncurses。据我所知ncurses还没有移植到windows上。所以我认为你不会让它发挥作用。

可能还有其他方法可以找出窗口上的屏幕宽度,但我无法帮助您。