Newby question: use Rubyinline error

I want to use rubyinline to write a simple code with inline c functions.

Here is my code:

require ‘rubygems’
require ‘inline’

class TestC
inline do |builder|
builder.c "
static void hello(int n) {
printf(“Hello %d\n”, n);
}
"
end
end

k = TestC.new
k.hello(5)

when I run this code, I get error as:

./inline.rb:5: undefined method inline' for TestC:Class (NoMethodError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inge
m_original_require’
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re
quire’
from inline.rb:2

Would anybody help to find what’s the err?

I use ‘gem install rubyinline’ to install rubyinline and get results as
‘Successfully installed RubyInline-3.6.2’, so I think the rubyinline
should be installed without err.

On 3/28/07, Ak 756 [email protected] wrote:

    from inline.rb:2

Would anybody help to find what’s the err?

You didn’t call your own source file ‘inline.rb’ by any chance? That
would
cause this error. Use a different filename.

Cheers,
Peter C.

On Mar 27, 2007, at 19:31 , Ak 756 wrote:

require ‘inline’

    from inline.rb:2

Don’t call your file inline.rb if you’re going to require ‘inline’.