SwiftUI MacOS gives Error: Undefined symbol: _main

Viewed 790

I downloaded a SwiftUI source that was built with Xcode Version 12.0 Beta 6, MacOS BigSur version 11.0 Beta. My system was MacOS Catalina, Xcode version 12.0.1.

While compiling, I faced lot of conversion errors one being @main attribute present in AppDelegate.swift

I removed the variable and built the application which resulted in the following error:

Error: Undefined symbol: _main

Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable

1 Answers

To solve the above issue, replace @main attribute in AppDelegate.swift with @NSApplicationMain attribute.

Related