Skip to content

Commit 1f2551b

Browse files
authored
Add /SUBSYSTEM:WINDOWS linker argument for GUI apps on Windows (#110)
Fixes undefined: main linker issue on windows 11 with swift 6.2
1 parent 043599b commit 1f2551b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SwiftBundler/Bundler/SwiftPackageManager/SwiftPackageManager.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ enum SwiftPackageManager {
214214
if buildContext.isGUIExecutable {
215215
let frontendArguments = ["-entry-point-function-name", "wWinMain"]
216216
let swiftcArguments = frontendArguments.flatMap { ["-Xfrontend", $0] }
217-
guiArguments = swiftcArguments.flatMap { ["-Xswiftc", $0] }
217+
guiArguments = swiftcArguments.flatMap { ["-Xswiftc", $0] } +
218+
["-Xlinker", "/SUBSYSTEM:WINDOWS"]
218219
} else {
219220
guiArguments = []
220221
}

0 commit comments

Comments
 (0)