Running c++ in browser

I see two options, but both very overkill:

  • Write (or find) a C++ interpreter in JavaScript
  • Use a VM running an operating system (e.g. jslinux and demonstrate your programs there.

The sensible option is to just give people a way to view and download the source code, I guess.


Use codepad, a website which lets you compile and share code online.

#include <iostream>

int main(int argc, char** argv) {
  std::cout << "Hello, Stack Overflow!" << std::endl;
  return 0;
}

There is also Google Native Client SDK that allows C++ code to run in browser. Microsoft Active X is also a viable option. I am only saying it is possible not recommended.


You can only run the program on your server, not on the client's machine.

At least not without downloading and manually executing it. Anything else would be an open door for malware...

Tags:

Html

C++