gpt4 book ai didi

ruby - 如何修复(RubyInstaller::Runtime::DllDirectory::WinApiError) in ruby on windows?

转载 作者:行者123 更新时间:2023-12-02 10:53:45 25 4
gpt4 key购买 nike

在代码中实现ruby2d时出现此错误

这是一个奇怪的运行时问题

Ruby2d代码

require 'ruby2d'
# Set the window size
set width: 300, height: 200
# Create a new shape
s = Square.new
# Give it some color
s.color = 'red'
# Show the window
show

错误
  8: from R.rb:1:in `<main>'
7: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
6: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
5: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/ruby2d-0.5.1/lib/ruby2d.rb:28:in `<top (required)>'
3: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/singleton.rb:12:in `add_dll_directory'
2: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/singleton.rb:12:in `new'
1: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/dll_directory.rb:50:in `initialize'


*C:/Ruby25-
x64/lib/ruby/site_ruby/2.5.0/ruby_installer/runtime/dll_directory.rb:83:in
`add_dll_directory_winapi': AddDllDirectory failed for
C:/Users/Salim/usr/local/bin
(RubyInstaller::Runtime::DllDirectory::WinApiError)*

,请帮助我修复

最佳答案

您必须从MINGW 64位命令提示符下运行项目。不是从常规的DOS提示符(Windows命令提示符)。

确保遵循以下说明:
http://www.ruby2d.com/learn/windows/

注意最后一段:

Using Ruby 2D on Windows

When working with Ruby 2D, make sure to use a MinGW 64-bit command prompt, rather than a standard one (cmd.exe) or the “Start Command Prompt with Ruby” found in the Start menu.

关于ruby - 如何修复(RubyInstaller::Runtime::DllDirectory::WinApiError) in ruby on windows?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51658119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com