I have read another stackoverflow post here, which was using c instead of c++. I am using c++, but when I try to follow these procedures except instead of emcc
i use em++
to build the wasm, it doesn't allow me to access the function. Suprisingly, when using a regular c file, it works. cm++
EDIT:
the command I am using to build the wasm file is
em++ -O2 test.cpp -o test.wasm -s WASM=1
EDIT 2:
I have discovered that emcc also works to build wasm from c++. I have used this command:
emcc -O2 test.cpp -o test.wasm -s WASM=1
but it still doesn't work.