Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile WebAssembly from multiple cpp files?

I'm using emscripten to compile c++ to WASM, but can only do this for one file at a time. I don't want to put my entire project and libraries in one file, but I haven't found any information on how to properly compile it.

like image 394
Josh Gordon Avatar asked Feb 10 '26 19:02

Josh Gordon


1 Answers

Just put all source files in the emcc command line like this:

emcc src1.cpp src2.cpp src3.cpp

See reference here: https://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html

like image 79
nzeemin Avatar answered Feb 12 '26 14:02

nzeemin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!