HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
297 stars 189 forks source link

Unable to compile after reinstalling Visual Studio #1127

Closed EgguMan closed 3 months ago

EgguMan commented 3 months ago

I had uninstall and reinstall Visual Studio because I was running out of space on my C:\ drive. After reinstalling, HXCPP is returning this error in the command pronm

D:\Games general\Games\FNF\source\eggu fork>setlocal enabledelayedexpansion Warning: Could not find Visual Studio VsDevCmd Error: 64bit is not automatically supported for this version of VC. Set HXCPP_MSVC_CUSTOM and manually configure the executable, library and include paths Error: Error: 64bit is not automatically supported for this version of VC. Set HXCPP_MSVC_CUSTOM and manually configure the executable, library and include paths

Heres the debugging steps I took in the Haxe discord

  1. Update app installer and install vswhere with winget install -e --id Microsoft.VisualStudio.Locator

  2. try winget install -e --id Microsoft.VisualStudio.2019.BuildTools

  3. running this in CMD "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath - it returned nothing

  4. running this in CMD "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 - it returned Visual Studio Locator version 3.1.7+f39851e70f [query version 3.9.2148.60653] Copyright (C) Microsoft Corporation. All rights reserved.

  5. running this in CMD "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -property installationPath - it returned my visual studio installation path

Here are some extra details.

Haxe version: 4.3.4 hxcpp version: git Visual studio components: Windows 10 SDK (10.0.18362.0), MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.29-16.11) Visual studio version: Visual studio 2022 (64-bit) - Current. 17.10.3 OS: Windows 10 Pro

EgguMan commented 3 months ago

update - changing my MSVC to v143 - VS 2022 C++ x64/x86 build tools (latest) seemed to fix it. I had tried this before getting help but I didnt get the same success.

My guess is vswhere was not installed, so I tried switching to the old MSVC version, and vswhere still wasnt installed so it returned the same error. Then, when I installed vswhere, it would still return the same error because it was not the correct MSVC version.

tobil4sk commented 3 months ago

In the VS 2022 install, only VS 2019 build tools (v142) were installed, which are reported as Microsoft.VisualStudio.Component.VC.v142.x86.x64. Hxcpp requires the installation to have the Microsoft.VisualStudio.Component.VC.Tools.x86.x64 component, which has to be the latest for that installation of Visual Studio.

https://github.com/HaxeFoundation/hxcpp/blob/9cdfc47a505e356a41433d367a30e09bf1ae8360/toolchain/msvc64-setup.bat#L14