views:

23

answers:

1

I have created a C Command Line app in Xcode 3.2.3. I have compiled SpiderMonkey from the command line, and have it working, this was for CouchDB 0.11. The js interpreter works, as well as all the files being in /usr/local/spidermonkey/include and /usr/local/spidermonkey/lib. I have added /usr/local/spidermonkey/include to my Header Paths, and /usr/local/spidermonkey/lib to my library path.

Every time I add the jsapi.h file from the /usr/local/spidermonkey/include and reference it in my main.c file. Compliation breaks. Why won't the following compile?

#include "jsapi.h"

int main (int argc, const char * argv[]) 
{
    return 0;
}
+1  A: 

I figured out what was wrong. For OSX there needs to be a #define XP_UNIX before you #include "jsapi.h". This isn't in any tutorial or examples or anything I can find on Google, but there is now! How to include SpiderMonkey in your XCode 3.2.3 project. Here is the corrected snippet of code.

#define XP_UNIX
#include "jsapi.h"

int main (int argc, const char* argv[]) 
{
    return 0;
}
fuzzy lollipop
Good catch, next time include a *few* of the 283 errors and someone might spot it sooner. :)
BobbyShaftoe