Fork me on GitHub

cheerp is the C++ compiler for the web
Write a web application, or port your existing one, all in C++. cheerp will generate JavaScript code that can run on any browser.

Learn more...    or see it in action!               

Chosen by

To get started with cheerp, follow these easy steps:

  1. Download and install cheerp binaries for your platform

  2. Follow the tutorial and visit the examples section

  3. Read the wiki and the DOM API reference.

main features

Programming the Web in C++

A seamless C++ programming experience for the Web.

Use cheerp to write your Web applications in fully type-safe C++ code, make use of uncountable existing libraries, leverage your existing knowledge, reuse your code, improve your productivity.

Cheerp generates optimized JavaScript code that is compatible with any browser, on any platform. Let the compiler spot errors for you at compile time, instead of hunting them at run-time.

Port existing applications or write new ones, all in C++

Cheerp is based on the proven and robust LLVM stack and fully compatible with almost all C and C++11 code. If you want to take advantage of transparent RPC support, you just need to add some tags to tell cheerp if you want your methods compiled for the server or for the client. Everything else (including client to server remote procedure calls, serialization and deserialization, etc.) will work automagically!

Full access to HTML5

Access any HTML5 API function, including DOM and WebGL, with no overhead or wrappers

With cheerp, you don't need to use any involved syntax or wrapper libraries to access all HTML5 functions from C++. A simple, type-safe browser API allows to generate JavaScript calls with no overhead.
HTMLElement* body=document.get_body();
HTMLElement* newElement=document.createElement("h1");
newElement->set_textContent("Hello World");

Learn more here.

Interact with JavaScript

Advanced support for interoperability with existing JavaScript code.

Cheerp allows to use C++ classes from JavaScript code using the [[jsexport]] attribute and embed arbitrary JavaScript code in C++ code with the __asm__ keyword. Find out more here here.
// C++: Expose the class to JavaScript
class [[jsexport]] JsStruct
        float a;
        JsStruct(float _a):a(_a) {}
        void test() { client::console.log("C++ code is been called!"); }
// JS: Call methods from your JS code
var testExport = new JsStruct(42.0);

In-browser debugging

Debug your C++ Web application from within the browser

Cheerp fully supports the SourceMaps standard, which makes it possible to debug your original C++ code directly in the browser. Set break points, step the execution and see the original C++ code when an exception happens.

You need to port an existing application or games to the web using HTML? We got you covered!

Since Cheerp compiled C++ code to JavaScript and offers seamless access to HTML5 you can port your applications and games to the Web like you would for any other platform.

By the way we offer porting consulting services, contact us if you are interested.

High Performance

Cheerp is based on the clang/LLVM project.

LLVM provides a bulletproof, state-of-the-art foundation for our compile-to-JavaScript technology.

Your code will pass through the full optimization stack provided by LLVM, plus a few Cheerp specific optimizations.

You write nice, easy to understand and maintain code, Cheerp will take care of generating highly optimized JavaScript from it.

The Web is more than just the browser.

Write client/server applications, frontend and backend, in one C++ codebase

With Cheerp, you can write a client-server Web application in a single codebase, in C++. Server-side binary and client-side JavaScript are created automagically. Remote functions are just a call away.
int GetAnswerToLifeTheUniverseAndEverything() [[server]]
    return 42;
void webMain() [[client]]
    const string str("The answer to life, the universe and everything is ");       
    console.log(str.c_str(), GetAnswerToLifeTheUniverseAndEverything());

Cheerp is neither a new framework, nor a new language

It is an extension of C++11, that gives Web 2.0 programming new foundations, on which frameworks can be built easily.