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。后面的數據是擴展之后的內存容量。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM