Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 将v8嵌入c++;visual studio 2012中的应用_C++_Visual Studio 2012_Embedded V8 - Fatal编程技术网

C++ 将v8嵌入c++;visual studio 2012中的应用

C++ 将v8嵌入c++;visual studio 2012中的应用,c++,visual-studio-2012,embedded-v8,C++,Visual Studio 2012,Embedded V8,我刚刚用visual studio 2012在windows 8上构建了V8,现在我想静态地将它链接到一个应用程序 除了我不知道从这里去哪里,我从谷歌那里得到了一些代码,我想尝试编译 #include <v8.h> using namespace v8; int main(int argc, char* argv[]) { // Get the default Isolate created at startup. Isolate* isolate = Isolate::

我刚刚用visual studio 2012在windows 8上构建了V8,现在我想静态地将它链接到一个应用程序

除了我不知道从这里去哪里,我从谷歌那里得到了一些代码,我想尝试编译

#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;
int main(int argc,char*argv[]){
//获取启动时创建的默认隔离。
隔离*隔离=隔离::GetCurrent();
//创建堆栈分配的句柄范围。
手柄镜手柄范围(隔离);
//创建一个新的上下文。
句柄上下文=上下文::新建(隔离);
//如果需要的话,下面是如何创建上下文的持久句柄。
持久上下文(隔离、上下文);
//输入所创建的编译上下文,然后
//运行helloworld脚本。
上下文::范围上下文\范围(上下文);
//创建包含JavaScript源代码的字符串。
handlesource=String::New('Hello'+',World!');
//编译源代码。
Handle script=script::Compile(源代码);
//运行脚本以获得结果。
句柄结果=脚本->运行();
//持久句柄需要最终处理。
持久化上下文.Dispose();
//将结果转换为ASCII字符串并打印。
字符串::ascivalue ascii(结果);
printf(“%s\n”,*ascii);
返回0;
}
我知道,如果我尝试在执行其他操作时包含v8头,它只会带来编译错误,这就是我想知道的


很抱歉,我没有提供足够的信息,老实说,我不完全确定需要什么来帮助解决我的问题,因此也非常感谢您对这方面的任何评论

您得到的编译错误是什么?您应该找到v8base.lib并链接到它。但是我怀疑你能静态地做,你需要v8.dll