Ⅱ. やり方
1. Emscripten をインストールする
git clone https://github.com/juj/emsdk.git cd emsdk emsdk install latest emsdk activate latest
2. C++をWebAssemblyとしてコンパイルする
main.cpp
#include <iostream> int main() { std::cout << "hello world" << std::endl; return 0; }
C:\emsdk\emsdk_env.bat emcc main.cpp -o main.wasm
3. Wasmer をインストールする
WasmerInstaller-x.x.x.exe
https://github.com/wasmerio/wasmer/releases
4. WebAssembly を実行する
wasmer run main.wasm
実行結果
hello world