VS2010 c/c++ 本地化 emscripten 配置

配置环境

1、下载emsdk-1.35.0-full-64bit.exe,有VS2010的话直接安装。

2、安装好之后,打开cmd,# emsdk update

                  # emsdk install latest

              #emsdk activate latest

3、确认是否安装完毕,如果从未运行过emscripten,cmd #emcc -v

4、运行c:\Emscipten\emscripten\1.35.0\tests中的hello_world.C,

#emcc hello_world.c,

编译完成之后# node a.out.js

如果cmd正常打印了hello wolrd。说明上面配置已经成功。

5、打开vs2010,建立工程,安装了emscipten之后,vs的platform中会有emscripten。

配置管理器选择,活动解决方案配置-》debug或release,活动解决方案平台-》emscripten。

6、配置环境变量,建立EMCC_WEBBROWSER_EXE,变量值为firefox或者chrome的执行文件路径。

 

emscripten使用

 

1、新建工程方法:新建-》新建一个空项目-》确认,编程-》配置管理器-》创建新的活动解决方案平台,选择emscripten,确认-》右键项目属性-》emcc linker-》Input-》Preload resources file改为需要添加的文件系统,如test.txt

2、如果遇到内存不足情况

 

Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 16777216, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0

 

 

可以扩充内存

 

方法:项目-》属性->emcc linker-》命令行  输入-s TOTAL_MEMORY=33554432。后面的数据是扩展之后的内存容量。

posted on 2015-12-29 12:00  重八  阅读(2893)  评论(1编辑  收藏  举报

导航