-
Notifications
You must be signed in to change notification settings - Fork 14
Visual Studio
Yuki Kimoto edited this page Mar 17, 2026
·
8 revisions
A guide to building Windows applications with Strawberry Perl, spvmcc, and Visual Studio.
On Windows Power Shell:
# Update winget sources
winget source update
# Install Strawberry Perl
winget install --id StrawberryPerl.StrawberryPerl --exact --accept-source-agreements
winget list --id StrawberryPerl.StrawberryPerl --exact
# Install Git
winget install --id Git.Git --exact --accept-source-agreements
winget list --id Git.Git --exact
# Install Visual Studio 2022 Build Tools
winget install --id Microsoft.VisualStudio.2022.BuildTools --exact --override "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive"
winget list --id Microsoft.VisualStudio.2022.BuildTools --exact
On Git Bash:
# Disable automatic CRLF conversion to keep line endings as-is
git config --global core.autocrlf false
# Prevent Git from quoting non-ASCII filenames in the output
git config --global core.quotepath false
On Git Bash:
find /c -maxdepth 6 -name perl.exe 2>/dev/null
The following instructions assume that your Perl executable is located at:
/c/Strawberry/perl/bin/perl.exe
Add Strawberry Perl bin directory to the head of PATH environment variable.
echo 'export PATH="/c/Strawberry/perl/bin:$PATH"' >> ~/.bashrc
Add make alias for gmake.
echo "alias make='gmake'" >> ~/.bashrc
Add alias for perldoc.
echo "alias perldoc='perldoc.bat'" >> ~/.bashrc
Reflect ~/.bashrc:
source ~/.bashrc
Check Perl version.
perl -v
Output Example:
Summary of my perl5 (revision 5 version 42 subversion 0) configuration:
Platform:
osname=MSWin32
osvers=10.0.26100.4652
archname=MSWin32-x64-multi-thread
uname='Win32 strawberry-perl 5.42.0.1 # 05:37:25 Fri August 01 2025 x64'
Install SPVM.
cpanm -v SPVM
Check spvm and spvmcc.
spvm -v
spvmcc -v
find "/c/Program Files/Microsoft Visual Studio" "/c/Program Files (x86)/Microsoft Visual Studio" -name cl.exe 2>/dev/null | \
/bin/perl -e '
# Get architecture (e.g., x86_64, aarch64)
$arch = `uname -m`; chomp $arch;
# Map uname to MSVC path string
$target = ($arch =~ /x86_64/) ? "Hostx64/x64" :
($arch =~ /aarch64/) ? "Hostarm64/arm64" : "Hostx86/x86";
while(<>) {
if (index($_, $target) != -1) {
# Convert to Windows path and print first match
s|^/([a-z])/|$1:/|i; s|/|\\|g; print; exit;
}
}
'
Ouput Example:
c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe
export MSVC_CC_LONG='C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe'
export MSVC_CC=$(/bin/perl -MWin32 -e "print Win32::GetShortPathName(q($MSVC_CC_LONG))")
export VCVARS=$(echo "$MSVC_CC" | /bin/perl -pe 's|VC\\Tools\\MSVC\\.*|VC\\Auxiliary\\Build\\vcvarsall.bat|i')
env MSYS2_ARG_CONV_EXCL="*" cmd.exe /c "$VCVARS x64 && set" | grep -iE "^(INCLUDE|LIB|PATH)="
Output Examples:
INCLUDE=C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\14.44.35207\include;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt
LIB=C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\14.44.35207\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x64
PATH=C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\VC\VCPackages;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\MSBuild\Current\bin\Roslyn;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Team Tools\DiagnosticsHub\Collector;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\Extensions\Microsoft\CodeCoverage.Console;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\Tools\;C:\Strawberry\perl\bin;C:\Strawberry\perl\bin;C:\Users\kimot\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\kimot\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Program Files\Git\cmd;C:\Users\kimot\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\Common7\IDE\VC\Linux\bin\ConnectionManagerExe;C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\vcpkg