Advertisement
Guest User

Untitled

a guest
Oct 18th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. #include <v8.h>
  2.  
  3. using namespace v8;
  4.  
  5. int main(int argc, char* argv[]) {
  6. // Get the default Isolate created at startup.
  7. Isolate* isolate = Isolate::GetCurrent();
  8.  
  9. // Create a stack-allocated handle scope.
  10. HandleScope handle_scope(isolate);
  11.  
  12. // Create a new context.
  13. Handle<Context> context = Context::New(isolate);
  14.  
  15. // Here's how you could create a Persistent handle to the context, if needed.
  16. Persistent<Context> persistent_context(isolate, context);
  17.  
  18. // Enter the created context for compiling and
  19. // running the hello world script.
  20. Context::Scope context_scope(context);
  21.  
  22. // Create a string containing the JavaScript source code.
  23. Handle<String> source = String::New("'Hello' + ', World!'");
  24.  
  25. // Compile the source code.
  26. Handle<Script> script = Script::Compile(source);
  27.  
  28. // Run the script to get the result.
  29. Handle<Value> result = script->Run();
  30.  
  31. // The persistent handle needs to be eventually disposed.
  32. persistent_context.Dispose();
  33.  
  34. // Convert the result to an ASCII string and print it.
  35. String::AsciiValue ascii(result);
  36. printf("%s\n", *ascii);
  37. return 0;
  38. }
  39.  
  40.  
  41.  
  42. test.cc:(.text+0x1a): undefined reference to `v8::Isolate::GetCurrent()'
  43. test.cc:(.text+0x34): undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
  44. test.cc:(.text+0x69): undefined reference to `v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)'
  45. test.cc:(.text+0xca): undefined reference to `v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)'
  46. test.cc:(.text+0x101): undefined reference to `v8::Context::Enter()'
  47. test.cc:(.text+0x115): undefined reference to `v8::Isolate::GetCurrent()'
  48. test.cc:(.text+0x12b): undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::String::NewStringType, int)'
  49. test.cc:(.text+0x16e): undefined reference to `v8::Script::Compile(v8::Handle<v8::String>, v8::ScriptOrigin*, v8::ScriptData*, v8::Handle<v8::String>)'
  50. test.cc:(.text+0x192): undefined reference to `v8::Script::Run()'
  51. test.cc:(.text+0x1da): undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
  52. test.cc:(.text+0x1fe): undefined reference to `v8::String::AsciiValue::AsciiValue(v8::Handle<v8::Value>)'
  53. test.cc:(.text+0x229): undefined reference to `v8::String::AsciiValue::~AsciiValue()'
  54. test.cc:(.text+0x243): undefined reference to `v8::Context::Exit()'
  55. test.cc:(.text+0x252): undefined reference to `v8::HandleScope::~HandleScope()'
  56. test.cc:(.text+0x270): undefined reference to `v8::String::AsciiValue::~AsciiValue()'
  57. test.cc:(.text+0x28f): undefined reference to `v8::Context::Exit()'
  58. test.cc:(.text+0x2ab): undefined reference to `v8::HandleScope::~HandleScope()'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement