Found the answer. Looks like I need to be using emrun to open html files and not directly on the browser.
emrun --browser "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" d:\src\emsdk\embind\greet.html Got it working! On Thu, Dec 24, 2020 at 3:27 PM Anand Arumugam <[email protected]> wrote: > I've been reading through Embind — Emscripten 2.0.9 documentation > <https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html> > and > was trying the first example - quick_example.cpp > > When I open the html file in the browser (edge chromium) I get the > following error: > > greeting.js:1365 both async and sync fetching of the wasm failed > abort @ greeting.js:1365 > greeting.js:1543 failed to asynchronously prepare wasm: RuntimeError: > abort(both async and sync fetching of the wasm failed) at Error > at jsStackTrace (file:///D:/src/emsdk/embind/greeting.js:1644:19) > at stackTrace (file:///D:/src/emsdk/embind/greeting.js:1661:16) > at abort (file:///D:/src/emsdk/embind/greeting.js:1370:44) > at getBinary (file:///D:/src/emsdk/embind/greeting.js:1468:5) > at file:///D:/src/emsdk/embind/greeting.js:1489:53 > (anonymous) @ greeting.js:1543 > greeting.js:1365 RuntimeError: abort(both async and sync fetching of the > wasm failed) at Error > at jsStackTrace (file:///D:/src/emsdk/embind/greeting.js:1644:19) > at stackTrace (file:///D:/src/emsdk/embind/greeting.js:1661:16) > at abort (file:///D:/src/emsdk/embind/greeting.js:1370:44) > at getBinary (file:///D:/src/emsdk/embind/greeting.js:1468:5) > at file:///D:/src/emsdk/embind/greeting.js:1489:53 > abort @ greeting.js:1365 > greeting.js:1376 Uncaught (in promise) RuntimeError: abort(RuntimeError: > abort(both async and sync fetching of the wasm failed) at Error > at jsStackTrace (file:///D:/src/emsdk/embind/greeting.js:1644:19) > at stackTrace (file:///D:/src/emsdk/embind/greeting.js:1661:16) > at abort (file:///D:/src/emsdk/embind/greeting.js:1370:44) > at getBinary (file:///D:/src/emsdk/embind/greeting.js:1468:5) > at file:///D:/src/emsdk/embind/greeting.js:1489:53) at Error > at jsStackTrace (file:///D:/src/emsdk/embind/greeting.js:1644:19) > at stackTrace (file:///D:/src/emsdk/embind/greeting.js:1661:16) > at abort (file:///D:/src/emsdk/embind/greeting.js:1370:44) > at file:///D:/src/emsdk/embind/greeting.js:1545:7 > at abort (file:///D:/src/emsdk/embind/greeting.js:1376:11) > at file:///D:/src/emsdk/embind/greeting.js:1545:7 > > My example file is named greeting.cpp and here's what's in it: > > #include <emscripten/bind.h> > > using namespace emscripten; > > std::wstring greet(const std::wstring& greeting) { > return std::wstring(L"Hello ") + greeting; > } > > float lerp(float a, float b, float t) { > return (1 - t) * a + t * b; > } > > EMSCRIPTEN_BINDINGS(my_module) { > function("greet", &greet); > function("lerp", &lerp); > } > > The compilation using emcc didn't give any errors. And it produced > greeting.js and greeting.wasm. Here's how I compiled the program: > > d:\src\emsdk\embind>emcc --bind -o greeting.js greeting.cpp > > d:\src\emsdk\embind>dir > > Directory of d:\src\emsdk\embind > > 12/24/2020 03:15 PM <DIR> . > 12/24/2020 02:56 PM <DIR> .. > 12/24/2020 03:17 PM 305 greet.html > 12/24/2020 03:15 PM 346 greeting.cpp > 12/24/2020 03:15 PM 164,401 greeting.js > 12/24/2020 03:15 PM 25,567 greeting.wasm > > Not sure what I'm doing wrong here. Any help is much appreciated. > > Thanks, > Anand. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "emscripten-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/emscripten-discuss/N6PdcpxyNp8/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/cb66608f-bc0a-4ea3-9477-e5afcfcd1b1an%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/cb66608f-bc0a-4ea3-9477-e5afcfcd1b1an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_2SaiCHamJEotQMUb3hJcCWgjDaSjq2eo39xYVvhLcTs-i4g%40mail.gmail.com.
