1

Visual Studio 2012 を使用して Windows 8 で V8 のビルドを完了したばかりで、それをアプリケーションに静的にリンクしたいと考えています。

ここからどこに行けばいいのかわからないことを除けば、Googleからいくつかのコードを取得してコンパイルしたいと思います

#include <v8.h>

using namespace v8;

int main(int argc, char* argv[]) {
  // Get the default Isolate created at startup.
  Isolate* isolate = Isolate::GetCurrent();

  // Create a stack-allocated handle scope.
  HandleScope handle_scope(isolate);

  // Create a new context.
  Handle<Context> context = Context::New(isolate);

  // Here's how you could create a Persistent handle to the context, if needed.
  Persistent<Context> persistent_context(isolate, context);

  // Enter the created 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::New("'Hello' + ', World!'");

  // Compile the source code.
  Handle<Script> script = Script::Compile(source);

  // Run the script to get the result.
  Handle<Value> result = script->Run();

  // The persistent handle needs to be eventually disposed.
  persistent_context.Dispose();

  // Convert the result to an ASCII string and print it.
  String::AsciiValue ascii(result);
  printf("%s\n", *ascii);
  return 0;
}

他のことをしてv8ヘッダーをインクルードしようとすると、コンパイルエラーが発生することはわかっています。それが知りたいことです。

提供された情報が不足していることをお詫びします。正直に言うと、問題を解決するために何が必要なのか完全にはわかりません。そのため、それに関するコメントもお待ちしています。

4

0 に答える 0