I'm attempting to install & compile Swift programs with the Swift compiler on Windows 10.
I first downloaded & installed the Swift compiler for Windows from the official Swift website. I have Visual Studio 2022 Community Edition, with the Desktop development with C++
package installed.
I then followed the official Windows tutorial on the Swift website, and tried both the Windows Package Manager method and the Traditional method. In each case, I couldn't access any of the Swift commands in either the Visual Studio Native Command Prompt or the standard Windows Command Prompt. swift
and swiftc
are unrecognized commands.
Albeit, I did create an Environment Variable for SDKROOT
with C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
(which does appear to contain the Swift libraries), yet it did not appear to fix the issue.
I also made sure that the visualc.modulemap
and visualc.apinotes
files that I was copying using the VS Native Command Prompt according to the tutorial had the correct naming of vcruntime.modulemap
and vcruntime.apinotes
, according to the following post.
Additionally, if I send an echo %PATH%
command to a Command Prompt to see whether I have a Swift path in the global environment variable, I saw a C:\Program Files\Swift\runtime-development\usr\bin
path present in the resultant path list. That path appears to contain a variety of DLL files relating to Swift and a single executable called plutil.exe
.
I then followed the following tutorial, where the instructor followed most of the same steps described in the Traditional method of the official Swift website tutorial, and attempted to compile a swift
file to an executable. Yet, my swift
and swiftc
commands still remained unaccessible in any Command Prompt.
I then followed the following tutorial, where the instructor creates a makefile and attempts to build a swift
file using that. However, attempting to run the nmake build
command in a Command Prompt on a makefile called build
simply resulted in the message 'build' is up-to-date
. I'm not familliar with the makefile program building methods, so I may very well be missing something here. The swift
and swiftc
commands remained unaccessible.
What is the proper way to install Swift on a Windows 10 system? Does Swift only work with Visual Studio 2019, and not 2022?
Thanks for reading my post, any guidance is appreciated.