https://zhuanlan.zhihu.com/p/158586853
https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
git clone https://hub.fastgit.org/emscripten-core/emsdk.git
# Fetch the latest version of the emsdk (not needed the first time you clone) git pull # Download and install the latest SDK tools. ./emsdk install latest # Make the "latest" SDK "active" for the current user. (writes .emscripten file) ./emsdk activate latest # Activate PATH and other environment variables in the current terminal source ./emsdk_env.sh
Note
On Windows, run emsdk
instead of ./emsdk
, and emsdk_env.bat
instead of source ./emsdk_env.sh
.
emcc main.cpp -o hello.js -s STANDALONE_WASM