[問題] 關於require
環境:
e.g. Ruby 1.9.2-p0
狀況:
一直引無法引用耶...爬google爬了好久仍然沒頭緒= = ''
看書上是說放在同資料夾就行了 還是不行= = ''
code:
[lib.rb] ↓
---------------------------------
def hello
print "hello I.m lib1\n"
end
---------------------------------
[lib.rb2] ↓
---------------------------------
require 'lib'
#use
hello()
---------------------------------
用的是windows的Start Command Prompt with Ruby
出現以下訊息
----------------------------------------------------------------------------
C:\Users\acer\Desktop\My Work Station\rb>ruby lib2.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load
--
lib (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from lib2.rb:2:in `<main>'
麻煩幫解決了> <''
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.46.113.169
※ 編輯: larrywhy 來自: 114.46.113.169 (12/10 23:26)
→
12/10 23:52, , 1F
12/10 23:52, 1F
→
12/11 11:37, , 2F
12/11 11:37, 2F
討論串 (同標題文章)
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章