如何在 windows ruby 中修复 (RubyInstaller::Runtime::DllDirectory::WinApiError)?
How to fix (RubyInstaller::Runtime::DllDirectory::WinApiError) in ruby on windows?
在代码中实现 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.
通过在 C/users/username
目录中创建 usr/local/bin
文件夹解决了这个问题
并粘贴了可以在 Link for dll 上找到的所需的 dll
提取它并从 bin 复制 dll 并粘贴到您创建的新 bin 目录中。
Imp- usr/local/bin
是我的默认 dll 加载目录我希望其他人也一样,但请正确检查错误消息。
在代码中实现 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.
通过在 C/users/username
目录中创建 usr/local/bin
文件夹解决了这个问题
并粘贴了可以在 Link for dll 上找到的所需的 dll
提取它并从 bin 复制 dll 并粘贴到您创建的新 bin 目录中。
Imp- usr/local/bin
是我的默认 dll 加载目录我希望其他人也一样,但请正确检查错误消息。