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. 判断文件是否存在(exist)

    set datedir=%date:~0,4%%date:~5,2%%date:~8,2%if exist d:\rollback\%datedir%\Server\ (rename d:\rollb ...

  2. Sql Server2005 Transact-SQL 窗口函数(OVER)

    1.简介: SQL Server 2005中的窗口函数帮助你迅速查看不同级别的聚合,通过它可以非常方便地累计总数.移动平均值.以及执行其它计算.窗口函数功能非常强大,使用起来也十分容易.可以使用这个技 ...

  3. nginx模块编程之获取客户ip及端口号

    ngx_request_t结构体中有一个connection定义,该定义指向一个ngx_connection_t的结构体: 结构体定义如下: struct ngx_connection_s { voi ...

  4. 在Java项目中整合Scala

    Scala是一个运行在Java JVM上的面向对象的语言.它支持函数编程,在语法上比Java更加灵活,同时通过Akka库,Scala支持强大的基于Actor的多线程编程.具有这些优势,使得我最近很想在 ...

  5. mysql 学习心得 [学习]

    http://www.cnblogs.com/lyhabc/p/3822267.html

  6. careercup-递归和动态规划 9.6

    9.6 实现一种算法,打印n对括号的全部有效组合(即左右括号正确配对). 类似leetcode:Generate Parentheses 解法: 从头开始构造字符串,从而避免出现重复字符串.在这个解法 ...

  7. DotNetTextBox使用方法步骤

    对于使用这个控件的研究我是用4个小时的工作终于完成成功了 现在请允许我在这里和你讲讲这个控件的使用方法 第一首先要从百度或是谷歌里下载一个dotnetTextBox第三方控件在解压后里面有三个文件 分 ...

  8. android 中uri.parse()用法

    android 中uri.parse()用法 1,调web浏览器 Uri myBlogUri = Uri.parse("http://xxxxx.com"); returnIt = ...

  9. RPC框架之Thrift

    目前流行的服务调用方式有很多种,例如基于SOAP消息格式的 Web Service,基于 JSON 消息格式的 RESTful 服务等.其中所用到的数据传输方式包括 XML,JSON 等,然而 XML ...

  10. How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS

    UPDATE 7/7/13: If you want to use Catalyst drivers version 12.8 you will find that X won’t start (er ...