Can one write a program in C++
and somehow make it run by someone else directly on the web, from a browser, without the other person having to download the .exe?

- 49,934
- 160
- 51
- 83

- 1,603
- 2
- 17
- 19
-
It's possible to run C++ programs in a browser using [Emscripten](https://emscripten.org/), but it's also possible to run them on a web server. – Anderson Green Nov 01 '19 at 23:58
3 Answers
A few days ago I would've downvoted this to oblivion and left an unhelpful comment about how little sense that made. Yesterday, however, I read an article on /r/programming which has led me to now consider your question perfectly valid :). The technology is called Native Client (NaCl):
Native Client (NaCl for short) is a Chrome specific technology that allows developers to code in C/C++ and produce a .nexe file, a compiled native module. These run inside the NaCl sandbox in Chrome.
The article in question is here and is about browser game development, mainly using HTML5.

- 2,301
- 16
- 17
-
Native Client is no longer supported in Chrome, but you can still compile C programs to run in a browser using [Emscripten](https://emscripten.org/docs/introducing_emscripten/about_emscripten.html). – Anderson Green Aug 29 '21 at 17:59
I suppose it depends on how complex a program you're talking about.
If you're referring to console applications which don't take too long to run, you can always use http://ideone.com/. For example: http://ideone.com/sGw5F

- 18,195
- 4
- 41
- 71
You should look into Native Client. From http://code.google.com/p/nativeclient/:
Native Client is an open-source technology that allows you to build web applications that seamlessly execute native compiled code inside the browser. This Google Code project is for maintaining the Native Client implementation, including compiler and browser support. If you're writing a compiler, are interested in porting Native Client to a new browser, or are researching the security mechanisms underlying Native Client, you can find useful resources in this project.

- 7,528
- 11
- 50
- 84
-
this is so amazing! never knew about this. Do you think this technology will be a killer one? I can see this killing off javafx and java applets and all of that. C++ is more powerful but because one can't run C++ programs in a browser, it is really a pain to have to download dll's and .exe's all the time to run something. It will be much easier to just write some game in C++ and have others run it in a browser like a java applet. Why is no one talking more about this? This is so cool. – Robert H Jan 26 '12 at 13:25