Getting started
To get started with Cheerp, youβll first need to install it.
Cheerp in itself has no dependencies, but the recommended workflow and the tutorials make use of:
- a JavaScript engine (such as Node.js)
- an HTTP server (such as http-server)
- a web browser
If you donβt have these, see recommended workflow.
Compiling your first application
You are now ready for compiling your first Web application using Cheerp.
Move to a folder of your choice and save the following C++ program as hello.cpp
.
You can then compile this program using the following command line:
Great, you have compiled your first program with Cheerp. You can now run the generated JavaScript directly with
You can also save this HTML file as hello.html
:
and from the same folder firefox hello.html
(or equivalent).
This is what the result should look like: hello.html
Why webMain()
instead of main()
?
It would have compiled also with std::cout<<
, printf()
or int main()
(try it yourself), but we wanted to show first what zero-overhead access to the browser looks like.