Export to Windows exe file

I am new to Haxe, but I spent 10 years with pure AS3 and 20 with JS/PHP.
I wanted a solution that is not drag and drop (I do not like Unity), is similar to AS3, and capable to export to Windows executable.
I installed Haxe, HaxeDevelop, OpenFL, Flash Player for preview debug, and already tried test code with success.
Now, I would like to know how can I export my code to Windows exe file?
Is it possible to do from HaxeDevelop or I need to use command line?
Is it using own engine or pack it with standard Adobe Flash Player?
I already used google for searching and reading, but I could not found what I exactly need to know.
I will very appreciate any suggestions and links, thanks!

If you want to build a native standalone, you should select the windows target in OpenFL.
You will need to install hxcpp (from haxelib) & Visual Studio first, though.
Otherwise, you can build to the Flash target (as a SWF file), and use the Debug Flash Player tool to export it to an executable.

1 Like

In HaxeDevelop, find the cog and play button in your toolbar. To the right of those are two drop down menus. Select either Release or Debug configuration, depending on whether this is a final build or not, then select windows as your target.

Hit the cog and wait for it to build. The first time you do this in your project will take a while as it’s compiling all the base dependencies.

Once you have Build Succeeded show up in the far bottom right corner of your HaxeDevelop window, it’s done. You’ll find your EXE in:
/bin/windows/bin/someProject.exe

You can also target Neko, for a much faster build process. I generally use this target while developing for faster debugging and testing.

Then don’t forget to do this:

haxelib run openfl setup

Only after you can compile your project.

1 Like

Thanks for explanation.
Hxcpp was installed during setup of OpenFL as far as I saw, but I will have to install that Visual Studio yet.
Does it mean that I will be able to compile AS3-like code (using Haxe language + OpenFL functions like bitmap and click events), not C++, to native standalone Windows exe (and maybe use steam_api.dll somehow)?
That is a goal I want to achieve.

Exactly, that’s the main goal of haXe : one language to learn, multiple targets to build :slight_smile:
Regarding Steam API, there is a haXe wrapper here : https://github.com/larsiusprime/SteamWrap

That is great, because pure AS3 was brilliant for 2D productions, while Unity with its drag and drop mess and weak 2D support did not bought me.
The last thing I guess, based on https://lime.software/docs/advanced-setup/windows/ suggestion, where can I find exactly Visual Studio C++ 2010 Express, since MS link is no more working.
I know that latest Visual Studio Community should do the work, but I would prefer to try out 2010 version.
Any sources where to get it (I already tried google, but I found only malware downloaders)?

Install the latest Visual Studio Community, I believe you should be fine :slight_smile:

Its me once again (I know you are happpy, yay!).
Well, based on this https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio article, 2017 requires 35 GB of space (not sure if installer files and temp space is counted), which is not possible for me right now due to multiple OS-es, large steam games, huge lossless music collection, large backup files, and other things that I can not delete.
This weight is many times more than even such Windows XP installation and sounds like wasting of space since I guess that about 5% or less of this will be used to just create that native windows exe thing?
Will it be enough if I install only “For C++ desktop development” like this (or do I need different package from this giant bundle, or maybe you know source for classic 2010): vs_community.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US

You’ll need packages (regardless of the Visual Studio version) for Win32 C++ development – you do not need all packages, nor is the latest version required :slight_smile:

Ok, so I could not make it work with VS Comunity, so I uninstalled it, because I found VSE 2010, and if anyone will be interested in the future, it can be downloaded from archive.org, so it is safe source and legal official ISO with only 700 MB to get (can be unpacked with 7-zip and run directly):
https://web.archive.org/web/20140227220734/download.microsoft.com/download/1/E/5/1E5F1C0A-0D5B-426A-A603-1798B951DDAE/VS2010Express1.iso
When I run debug windows from HaxeDevelop, then I get this error (I already did restart):
Error: 64bit is not automatically supported for this version of VC. Set HXCPP_MSVC_CUSTOM and manually configure the executable, library and include paths
But everything compiles fine when I try manually in directory of the project (at least something!):
openfl test windows -32
I went to my second system, Windows XP to check if compiled exe will also work there, but I get this errors (I read it has something to do with QT version):
The procedure entry point CancelIoEx could not be located in the dynamic link library KERNEL32.dll
Could not load module [email protected]_create_application_prime
Does it mean that XP is no more supported, or is it something on my end during compilation?

We don’t have Windows XP systems to use for testing anymore.

Although we are not testing against Windows XP, we’re happy to accept patches to improve support so long as they seem reasonable.

This one is a little tricky – there may not be a suitable replacement pre-Vista for this feature – but we use it only in code that is used when adding a watch for faster development, but not something that a user would need in the binary.

Perhaps some things could be guarded behind some kind of a WINXP_COMPATIBLE define? So lime rebuild windows -DWINXP_COMPATIBLE in order to make an XP release? Are many users using XP?

Well, I guess that XP is niche today, so if backward compatibility requres more effort, then its fine.
Just wondered if it is something on my own side (some parameter or other thing required to meet).