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 code compile?
#include "jsapi.h"
int main (int argc, const char * argv[])
{
return 0;
}
I figured out what was wrong. For OSX there needs to be a
#define XP_UNIXbefore 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.