I know there's severals post about this, but i'm stack
here's my C code
#include </usr/include/ruby-1.9.1/ruby/ruby.h>#include <stdio.h>#include <stdlib.h>int main(){ ruby_init(); rb_eval_string("puts 'hello'"); ruby_finalize(); return 0; }i've got the following error when compile it in sublime text 2
In file included from /Users/pierrebaille/Code/Ruby/embedRuby/embedRubyFirst.c:1:/usr/include/ruby-1.9.1/ruby/ruby.h:1481:24: error: ruby/subst.h: No such file or directory [Finished in 0.1s with exit code 1]thanks for your help
2 Answers2
You should not hard-code the full path of a header file like
#include </usr/include/ruby-1.9.1/ruby/ruby.h>
proper is
#include <ruby.h>
and told your gcc to search the header file via CFLAGS and libariy via LD_FLAGS, simply command without makefile could be:
gcc -o demo.exe -I/path/to/ruby/headers rubydemo.c -L/path/to/ruby/lib -lruby-libary-name
2 Comments
One of you files you're including in turn includesruby/subst.h, , but it appears thatruby is not in your path, which is why you have this in your code:
#include </usr/include/ruby-1.9.1/ruby/ruby.h>Instead of hardcoding paths you should simply add "/some_path/" to your compiler path(s) setting, wheresome_path contains the folderruby as a child. Now your own include turns into:
#include <ruby/ruby.h>3 Comments
Explore related questions
See similar questions with these tags.
