Can not build for windows

Hi when creating exe file for windows, i had this error (i have VS community installed on my machine C:\Program Files (x86)\Microsoft Visual Studio )
Warning: Could not find Visual Studio 2017 VsDevCmd
Error: Could not automatically setup MSVC
Build halted with errors.

msvc-setup.bat (using hxcpp 4.0.4)

setting up for windows


<!-- classpath, haxe libs -->
<source path="src" />
<source path="lib" />
<haxelib name="openfl" />
<haxelib name="starling" />
<!-- assets -->
<icon path="assets/openfl.svg" />
<assets path="assets/img" rename="img" embed="false"/>
<assets path="assets/sounds" rename="sounds" embed="false"/>
<assets path="assets/fonts" rename="fonts" embed="false"/>

Any help would be appreciated. Thanks!

What version of Visual Studio Community is installed?

Have you restarted the machine since the install, or at least closed and re-opened the command-prompt? Sometimes, environment variables do not update until after a reboot.

hi singmajesty. i have updated my vs community to the lastest version and ran the command line after my computer is restarted. is there any way to set environment variables manually?.

What is your “C:\Program Files (x86)\Microsoft Visual Studio” folder like? Does it have a “2017” folder, or an “Installer\vswhere.exe” executable?

hi @singmajesty
Yes, it does, it has a “2017” folder. the full paths are C:\Program Files (x86)\Microsoft Visual Studio\2017\Community and C:\Program Files (x86)\Microsoft Visual Studio\Installer. Just tried to run command line (lime setup windows) again but still have no luck. I’m using lime ver 7.2.1.

Oh, interesting

It looks like it is using vswhere.exe, not falling through to the VS Community 2017 exact path below in “msvc-setup.bat”

Could you try running C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -latest -products and see what it returns?

Did you check the boxes in the Visual Studio install for Windows Desktop (Win32) C++?

Hi singmajesty

  • while running vswhere.exe, i have this info.
  • I’ve uninstalled VS and all visual C++ components on my machine, then re-install new VS Community 2017 with just Windows Desktop (Win32) checked.

    and sadly I’m not able to run command line to set up for windows build. thanks for your time!

I found this Some devs had same issues while building for Windows with VS Community 2017. I guess Lime works well with VS 2015?

This is an HXCPP issue, not a Lime/OpenFL issue, but it is curious because I use Visual Studio Community 2017 myself :confused:

Any news about this issue? hxcpp has been updated to version 4.0.8 but the problem is still there. :frowning:

Hi! I get it working with hxcpp 3.4.64 lime 6.2.0 openfl 7.1.2 but I had another error while building.
" Error: pcre_exec.c
C:/HaxeToolkit/haxe/lib/hxcpp/3,4,64/project/thirdparty/pcre-7.8/pcre_exec.c : fatal error C1033: cannot open program database ‘e:\cloud\dropbox\haxestarlingtest\bin\windows\obj\obj\msvc16-debug-ncxp\vc.pdb’"
Any suggestions? Thanks!

After restarting computer and clean all old windows build, it works well. Thanks for reading!
ah, just another question. is it safe if we use haxe starling along with old version of openfl and lime? i love starling api and it’s assetmanager, bitmap font:)

Sure! I think it should work fine. Let me know if you have issues :smile:

Unfortunately, I have exact same problem with building by VS2017, now trying to setup VS2015 and I should say It is very disappointing to face like this issues for new developers like me, I do not know how to code- just basics- and there is some feeling in me wanting to learn and do flash games. But it is hard process I think, and it decreases my ambition, I feel sorry about that. Any advices appreciated. Thanks.

You should install visual c++ express and use the old version of openfl/lime/hxcpp as mentioned above when building for windows.

The old Visual Studio Express works fine… but I use VS Community 2017 I believe without issues

I have to install the “Windows C++ Desktop” packages, restart the computer after the install (for environment variables to populate) and have a current HXCPP library from Haxelib

I can now create .exe file for windows by using the latest versions of lime, openfl hxcpp and VS 2019 (check all desktop C++ components).
And you might delete (or edit) all the config files - C:\Users\UserName\ .lime and C:\Users\UserName\ .hxcpp_config.xml