Hey All.
I’m trying to figure out why the ruby.h dir is not giving me the right
location using RbConfig in Ruby 1.9.3 on Windows.
I ran irb
loc = File.join( Config::CONFIG[‘archdir’], ‘ruby.h’)
=> “C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/ruby.h”
No deprecation warning as below would.
but that’s not where it is.
So I ran
RbConfig::CONFIG.each { | k, v | puts “#{k} => #{v}\n” }
and found
includedir => C:/Ruby193/include
which is where it is.
The reason I ask is that from the book Ruby Cookbook
I’m trying to get the first example from “chapter 22.1 Writing a C
Extension for Ruby” to compile with make. I have devkit set up okay I
think. But that RbConfig::Config has me confused as to why it points to
the wrong directory.
I run
ruby extconf.rb
and get my makefile
Then I run make
make
compiling example.c
example.c:5:14: error: static declaration of ‘rb_cClass’ follows
non-static declaration
In file included from c:/Ruby193/include/ruby-1.9.1/ruby.h:32:0,
from example.c:1:
c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1249:19: note: previous
declaration of ‘rb_cClass’ was here
example.c: In function ‘print_string’:
example.c:10:28: error: ‘struct RString’ has no member named ‘ptr’
make: *** [example.o] Error 1
Can anyone help me?
Is there a way to set the config for the correct directory even if this
is not what the problem is?