hello_world on https://developers.google.com/v8/get_started does not work
for me.
I had to use the following to make it work:
#include <v8.h>
using namespace v8;
int main(int argc, char* argv[])
{
V8::InitializeICU();
Isolate* isolate = Isolate::New ( );
Isolate::Scope isolate_scope ( isolate );
// Create a stack-allocated handle scope.
HandleScope handle_scope(isolate);
// Create a new context.
Handle<Context> context = Context::New(isolate);
// Enter the context for compiling and running the hello world script.
Context::Scope context_scope(context);
// Create a string containing the JavaScript source code.
Handle<String> source = String::NewFromUtf8(isolate, "'Hello' + ',
World!'");
// Compile the source code.
Handle<Script> script = Script::Compile(source);
// Run the script to get the result.
Handle<Value> result = script->Run();
// Convert the result to an UTF8 string and print it.
String::Utf8Value utf8(result);
printf("%s\n", *utf8);
return 0;
}
and compile with :
g++ -Iinclude -g test.cc -o test -Wl,--start-group
out/x64.release/obj.target/{tools/gyp/libv8_{libbase.x64,base,snapshot},third_party/icu/libicu{uc,i18n,data}}.a
-Wl,--end-group -lrt -lpthread
Can someone please verify, and update the web page. It took me two hours to
put all the pieces together to make it work.
Thanks,
Varol
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.