# Project won't compile emscripten code

**URL:** <https://forums.unrealengine.com/t/project-wont-compile-emscripten-code/351865>\
**Category:** Platform & Builds\
**Tags:** HTML5, javascript, unreal-engine, compile, question, CPP\
**Created:** [March 26, 2016, 6:49pm UTC](https://forums.unrealengine.com/t/project-wont-compile-emscripten-code/351865 "2016-03-26T18:49:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![generallyjansen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@generallyjansen](https://forums.unrealengine.com/u/generallyjansen)\
**Post date:** [March 26, 2016, 6:49pm UTC](https://forums.unrealengine.com/t/project-wont-compile-emscripten-code/351865/1 "2016-03-26T18:49:51Z")

</div>

I’ve been brought onto a project with some specific goals: it is a game to be packaged for HTML5 deployment and the game needs to be able to talk to the chrome API for certain calls (Specifically, for the webkitSpeechRecognition object).  
In my original investigation on how to do this, it looked like emscripten was capable of the task (link [here](https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code-call-javascript-from-native)).

The project is a blueprints project, and so my thought was to make a set of functions in c++ that make the required calls to chrome and then call those from blueprints. However, even though the UE4 project apparently packages with emscripten, it won’t let me compile the c++ code in the project because it doesn’t “recognize” the emscripten macros.

Since it can’t compile, I can’t make the blueprints side recognize the function that I’ve written.

Is there:

- Any way to make unreal compile my emscripten code?

- Any way to compile without the unreal engine? (I tried compiling from the emscripten  
terminal and it couldn’t find engine.h)

- Any other way to call javascript from inside the game?

I will be greatly appreciative to anyone who can help with this. I can’t be the only one who’s trying to do this. Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bdfdc515](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bdfdc515](https://forums.unrealengine.com/u/anonymous_user_bdfdc515)\
**Post date:** [August 8, 2016, 11:51am UTC](https://forums.unrealengine.com/t/project-wont-compile-emscripten-code/351865/2 "2016-08-08T11:51:44Z")

</div>

It’s a bit late but I stumbled across this question this post while trying to solve a similar problem so I thought I’d share my solution: [Js/c++ communication - Platform & Builds - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?119332-js-c-communication&p=576340#post576340)

Only tested it with UE 4.12

---

<div class="post-metadata">

**Author:** ![generallyjansen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@generallyjansen](https://forums.unrealengine.com/u/generallyjansen)\
**Post date:** [August 8, 2016, 1:31pm UTC](https://forums.unrealengine.com/t/project-wont-compile-emscripten-code/351865/3 "2016-08-08T13:31:56Z")

</div>

Wow this looks really promising! Thanks for going out of your way to find my post. I’ll definitely give this a shot.
