Swift c++ wrapper command on Windows

I'm trying to write a c++ wrapper for Swift Windows. The commands are not working

# build:
swift build -Xcxx -std=c++11

# build release:
swift build -c release -Xcxx -std=c++11

# test:
swift test -Xcxx -std=c++11

# run:
swift run -Xcxx -std=c++11

So I have just installed swift on Windows & I have been told to follow this command:

swiftc -sdk %SDKROOT% -I %SDKROOT%\usr\lib\swift -L %SDKROOT%\usr\lib\swift\windows test.swift

instead of just swift test.swift

I have MinGW installed on Windows as well...as well as Visual Studio 2019

MinGW doesn't play into this. The windows support is purely Windows, it does not use MinGW. The C++ runtime that is in the address space due to the Swift runtime is the Microsoft C++ runtime.

The reason those commands do not work is because swift package manager does not yet support Windows. I would recommend that you read up on CMake if you are looking to build projects in an automated fashion on Windows. There are plenty of examples (like the core libraries and there are additional examples on GitHub such as Swift/Win32 as well).

2 Likes
Terms of Service

Privacy Policy

Cookie Policy