From: "Mauricio Fernández" Date: 2003-02-26T18:22:27+09:00 Subject: Re: Embedding Ruby in C code On Wed, Feb 26, 2003 at 03:54:44PM +0900, Edward Wilson wrote: > Paul Brannan wrote in message news:<20030225151304.GZ22892@atdesk.com>... > > On Tue, Feb 25, 2003 at 04:32:02PM +0900, Edward Wilson wrote: > > > * I downloaded the 1.8 source straight from CVS > > > * and the following will not compile. > > > > What error message do you get? > > > > Paul > > Thanks for asking: > > I'm getting the following error: > > `undefined reference to ruby_init()' > > My code again is: > > #include "ruby.h" > > int main(int argc, char **argv) > { > ruby_init(); > return 0; > } > > > I have gotten past this several times with ruby 1.6.7 and others, this > is the first time I have gotten this error. This is the first time I > have built with ruby 1.8. If I'm right it compiles OK but you get the problem when linking (although it can be done in a single step...) batsman@tux-chan:/tmp$ cat tst.c #include "ruby.h" int main(int argc, char **argv) { ruby_init(); return 0; } batsman@tux-chan:/tmp$ gcc -I /usr/lib/ruby/1.6/i386-linux/ -o tst tst.c /tmp/cc7Gey6B.o(.text+0x7): In function `main': : undefined reference to `ruby_init' collect2: ld returned 1 exit status batsman@tux-chan:/tmp$ gcc -I /usr/lib/ruby/1.6/i386-linux/ -o tst tst.c -lruby batsman@tux-chan:/tmp$ ./tst batsman@tux-chan:/tmp$ [s/1.6/1.8/g above] I would suggest that you not assume systematically that things are broken ;-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com We all know Linux is great... it does infinite loops in 5 seconds. - Linus Torvalds about the superiority of Linux on the Amterdam Linux Symposium