Subj : Re: SpiderMonkey Examples To : netscape.public.mozilla.jseng From : Jeremy Gillick Date : Thu Jul 14 2005 12:14 pm This is a multi-part message in MIME format. --------------020104000400020602030307 Content-Type: multipart/alternative; boundary="------------030909030904090803060001" --------------030909030904090803060001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Now I'm getting the following errors when I try to compile the attached code (which I got from The Embedder's Guide) ld: Undefined symbols: _JS_Init _JS_InitStandardClasses _JS_NewContext _JS_NewObject Thanks, Jeremy Jeremy Gillick wrote: > Ah ha! Thanks it's fixed now. It actually wasn't a build problem at > all. I thought I included that file in my project, and I hadn't. Thanks! > > Brendan Eich wrote: > >> Jeremy Gillick wrote: >> >>> On line #5, before including jsapi.h, I have "#define XP_UNIX", and >>> still no joy. Am I doing it correctly? >> >> >> Looking at the errors slightly more closely (you too can see this): >> >> jstypes.h:231:71: jsautocfg.h: No such file or directory >> >> That means you have not run jscpucfg. Makefile.ref should do this >> for you in its $(OBJDIR)/jsautocfg.h rule. Debug why it didn't. >> >> /be > --------------030909030904090803060001 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Now I'm getting the following errors when I try to compile the attached code (which I got from The Embedder's Guide)

ld: Undefined symbols:
_JS_Init
_JS_InitStandardClasses
_JS_NewContext
_JS_NewObject


Thanks,
Jeremy

Jeremy Gillick wrote:
Ah ha!  Thanks it's fixed now.  It actually wasn't a build problem at all.  I thought I included that file in my project, and I hadn't.  Thanks!

Brendan Eich wrote:
Jeremy Gillick wrote:
On line #5, before including jsapi.h, I have "#define XP_UNIX", and still no joy.  Am I doing it correctly?

Looking at the errors slightly more closely (you too can see this):

jstypes.h:231:71: jsautocfg.h: No such file or directory

That means you have not run jscpucfg.  Makefile.ref should do this for you in its $(OBJDIR)/jsautocfg.h rule.  Debug why it didn't.

/be
--------------030909030904090803060001-- --------------020104000400020602030307 Content-Type: text/plain; x-mac-type="54455854"; x-mac-creator="522A6368"; name="simple.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="simple.c" #include #include #include #define XP_UNIX #define JSFILE /* include the JS engine API header */ #include "jsapi.h" /* main function sets up global JS variables, including run time, * a context, and a global object, then initializes the JS run time, * and creates a context. */ int main(int argc, char **argv) { int c, i; /*set up global JS variables, including global and custom objects */ JSVersion version; JSRuntime *rt; JSContext *cx; JSClass *clasp; JSObject *glob, *it; JSBool builtins; /* initialize the JS run time, and return result in rt */ rt = JS_NewRuntime(8L * 1024L * 1024L); /* if rt does not have a value, end the program here */ if (!rt) return 1; /* create a context and associate it with the JS run time */ cx = JS_NewContext(rt, 8192); /* if cx does not have a value, end the program here */ if (cx == NULL) return 1; /* create the global object here */ glob = JS_NewObject(cx, clasp, NULL, NULL); /* initialize the built-in JS objects and the global object */ builtins = JS_InitStandardClasses(cx, glob); return 0; } --------------020104000400020602030307-- .