Original Post
Hi all, I am now trying to embed the engine(written in C) into my game(written in C++), I would like to use the script to change the AI of the game. When i compile the following code (copied from http://www.mozilla.org/js/spidermonkey/apidoc/jsguide.html): #include #include #include /* include the JS engine API header */ #define XP_PC #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) { /*set up global JS variables, including global and custom objects */ JSVersion version; JSRuntime *rt; JSContext *cx; 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; return 0; } A linking error (LNK2001) occurs. And i have tried many mehtods to solve the problems, but all are failed. Does any body can know the problem. Actually, i am the new comer of C++. Moreover, Is javascript suitable in game development? As i want to reduce the development time. Thank you!!!