[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compiling and linking a trivial guile example

From: Ido Yehieli
Subject: compiling and linking a trivial guile example
Date: Wed, 05 Apr 2006 12:53:42 +0200
User-agent: Mail/News 1.5 (X11/20060309)

I've contemplating embedding guile as a scripting language in one of my c++ applications.

I've been reading the reference manual, and tried compiling the first example (from

*****start simple-guile.c*****
     #include <stdlib.h>
     #include <libguile.h>

     static SCM
     my_hostname (void)
       return scm_str2string (getenv ("HOSTNAME"));

     static void
     inner_main (void *data, int argc, char **argv)
       scm_c_define_gsubr ("my-hostname", 0, 0, 0, my_hostname);
       scm_shell (argc, argv);

     main (int argc, char **argv)
       scm_boot_guile (argc, argv, inner_main, 0);
       return 0; /* never reached */
***** end  simple-guile.c*****

like instructed, with:

gcc -o simple-guile simple-guile.c -lguile

However, i get this error message:

/tmp/ccerLXy4.o: In function `my_hostname':simple-guile.c:(.text+0x16): undefined reference to `scm_str2string'

I tried also compiling it with:

gcc -o simple-guile simple-guile.c -lguile -lguile-ltdl -lqthreads -lpthread -lcrypt -lm

because 'guile-config link' gave the following:

-lguile -lguile-ltdl -lqthreads -lpthread -lcrypt -lm

but to no avail. guile-config compile returns an empty line.
What am I doing wrong?

Ido Yehieli.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]