2019-07
Haxe can compile to many different target platforms. This doc is a guide to compiling your Haxe code to C++ and then building it on Debian GNU/Linux (the “testing” distribution).
To install the latest version of Haxe onto GNU/Linux, see my getting started with Haxe doc.
Install the usual GNU compiler, linker, and other build tools;
# apt install build-essential
hxcpp (source code) is the runtime support for the Haxe compiler’s C++ back-end.
Install it:
haxelib install hxcpp
See https://haxe.org/manual/target-cpp.html
Try it out on some code. cd path/to/my-proj
. Create a src/Main.hx file containing:
and a cpp.hxml file containing:
-p src
-m Main
--cpp out
and make that “out” directory: mkdir out
.
Now build and run the resulting executable:
$ haxe cpp.hxml
$ ./out/Main
getting this output:
Main.hx:3: Hello, World!
For the full docs, see the C++ target chapter of the manual.