OS:Window 7

1.下载v8 zip:https://github.com/v8/v8,解压zip,重命名v8-master文件夹为v8。

2.下载安装svn:http://tortoisesvn.net/downloads.html。安装后确认C:\Program Files\TortoiseSVN\bin被加到环境变量path

3.在v8根目录下Check out gyp

运行cmd:cd v8,切换到v8的根文件夹

运行cmd: svn co http://gyp.googlecode.com/svn/trunk build/gyp, gyp安装到v8/build/gyp

4.在v8根目录下Check out ICU

运行cmd:svn co https://src.chromium.org/chrome/trunk/deps/third_party/icu46 third_party/icu

5.在v8根目录下Check out cygwin

运行cmd:svn co http://src.chromium.org/svn/trunk/deps/third_party/cygwin@231940 third_party/cygwin

6.下载安装python 2.7.X:http://www.python.org/download/,安装后将python.exe的路径添加到path环境变量中

7.运行cmd:python build\gyp_v8 -Dtarget_arch=x64(注:按装python后要打开新的cmd窗口,并且当前目录切换到v8的根文件夹)

8.运行cmd:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\dev
env.exe" /build release build\all.sln,或者用VS2010打开v8\build\all.sln, build. Build成功后在v8\build\Release\lib生成v8_base.x64.lib,v8_nosnapshot.x64.lib,v8_snapshot.lib,icui18n.lib,icuuc.lib。

9.用VS2010创建一个c++ Win32 Console Application,添加x64 build配置。在linker里面导入v8_base.x64.lib,v8_nosnapshot.x64.lib,v8_snapshot.lib,icui18n.lib,icuuc.lib,ws2_32.lib,winmm.lib。

10.Copy/Paste以下代码到main函数

#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); // 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 ;
}

11.Build,如果出现以下linker error,添加msvcprtd.lib;MSVCRTD.lib到linker/input/Ignore Specific Default Libriries

>LIBCMT.lib(memcpy.obj) : error LNK2005: memmove already defined in MSVCRTD.lib(MSVCR100D.dll)

Google v8 - Hello world的更多相关文章

  1. Google V8编程详解(五)JS调用C++

    http://blog.csdn.net/feiyinzilgd/article/details/8453230 最近由于忙着解决个人单身的问题,时隔这么久才更新第五章. 上一章主要讲了Google ...

  2. Google V8编程详解附录

    Google V8编程详工具函数 头文件:utils.h #ifndef UTILS_H_ #define UTILS_H_ #include "v8.h" #include &l ...

  3. Google V8编程详解(序)Cloud App

    此系列文章转载于此http://blog.csdn.net/feiyinzilgd/article/details/8247723          应用程序发展到今天,应用程序的概念也在不断地发生着 ...

  4. Google V8扩展利器发布:v8-native-binding-generator

    用C++扩展Google V8很简单,但是类比较多时还是很烦的.前段时间开发cantk-runtime-v8时,我写了一个代码产生器v8-native-binding-generator,让扩展Goo ...

  5. 用NAN简化Google V8 JS引擎的扩展

    通过C++扩展Google V8 JS引擎的文章很多,Google V8 JS带的例子也容易明白.但是大部分文章都是Hello World型的,真正使用时发现处处是坑.扩展V8最经典的例子就是node ...

  6. 在Android上使用Google V8 JS 引擎

    在cantk-runtime中直接使用的webview,通过JAVA扩展接口把Canvas的2d Context的API定向到JNI,通过OpenGL来图形加速,渲染速度大大提高.后来测试发现在大部分 ...

  7. google v8引擎常见问题

    最近在项目中使用v8来进行扩展,下面简单说一下使用v8过程中遇到的一些问题.   v8的多线程调用 最初调研v8的测试代码是单线程的,后来一个项目在多线程中使用,出现了一些问题,后来看到参考3中的才恍 ...

  8. Google V8 引擎 原理详解

    V8 引擎概览 V8 引擎简介 Google V8 引擎使用 C++ 代码编写,实现了 ECMAScript 规范的第五版,可以运行在所有的主流 操作系统中,甚至可以运行在移动终端 ( 基于 ARM ...

  9. JavaScript 性能优化 --By Google V8 Team Manager

    原文:https://developers.google.com/v8/?hl=zh-CN Be Prepared before writing code[9:35] Understand how V ...

  10. [原创]Windows下Google V8 javascript引擎编译

    项目用到将v8嵌入到C++的情况,公司没时间研究,只有在家研究,编译过程一堆坑.记录一下. 网上百度的都是基于vs2010,或者早版本的v8编译,最新版本应该使用vs2013\vs2015.本文介绍的 ...

随机推荐

  1. 软中断&amp;tasklet&amp;工作队列

    软中断 软中断的分配时静态的(即在编译时定义),而tasklet的分配和初始化能够在执行时进行. 软中断(即便是同一种类型的软中断)能够并发地运行在多个CPU上. 因此,软中断是可重入函数并且必须明白 ...

  2. C# DataTable的詳細使用方法

    在项目中经经常使用到DataTable,假设DataTable使用得当,不仅能使程序简洁有用,并且可以提高性能,达到事半功倍的效果,现对DataTable的使用技巧进行一下总结. 一.DataTabl ...

  3. Java synchronized 总结

    在Java开发的时候经常会用到关键字synchronized来对代码进行同步,在使用的过程中,对于synchronized确不是很熟悉,最近在看Spring源码时,发现有不少地方都用到同步,因此,趁此 ...

  4. windows下使用redis,Redis入门使用,Redis基础命令

    windows下使用redis,Redis入门使用,Redis基础命令 >>>>>>>>>>>>>>>> ...

  5. Atom编辑器入门到精通(四) Atom使用进阶

    在本节中将介绍Atom提供的更高级的使用技巧,通过这些技巧将会进一步提高你的代码编写效率 代码片段(Snippets) Snippets是一种在代码中快捷插入代码块的方式,下面是维基百科中对Snipp ...

  6. 关于redhat6的服务说明

    服务名称 功能 默认 建议 备注说明 NetworkManager 主要用于图形网络连接管理 开启 关闭 对服务器无用 abrt-ccpp Automated Bug Reporting Tool 开 ...

  7. Ios 给imageview 添加手势没有反应

    道理差不多,简单写写,就是给UIImage所在的UIImageView添加个单击的手势,让用户点击图片时有响应的响应. 有人用个透明的UIButton,感觉有时候不方便.   - (void)view ...

  8. IOS-开发日志-UILabel相关

    UILabel属性 1.text:设置标签显示文本. 2.attributedText:设置标签属性文本. Ios代码 NSString *text = @"first"; NSM ...

  9. 2、Charm Bracelet( poj 3624)简单0-1背包

    题意:有n件手镯,总重量不能超过M,每个手镯有一个体重W[i]和魅力V[i],问在不超过M的情况下能获得的魅力总和 思路:把M当背包总容量,用0-1背包写 代码: #include <iostr ...

  10. 九度OJ 1081 递推数列 -- 矩阵二分乘法

    题目地址:http://ac.jobdu.com/problem.php?pid=1081 题目描述: 给定a0,a1,以及an=p*a(n-1) + q*a(n-2)中的p,q.这里n >= ...