jj11 opened issue aparoksha/adwaita-swift#72

jj11
2025-09-30T21:02:34+02:00

72#Not able to run the app#

Describe the bug

Throws an error not sure why?

 swift build
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/home/joker/Desktop/Bare-Swift/Sources/main.swift:4:1: error: 'main' attribute cannot be used in a module that contains top-level code
 1 | import Adwaita
   | |- note: top-level code defined in this source file
   | `- note: pass '-parse-as-library' to compiler invocation if this is intentional
 2 |
 3 |
 4 | @main
   | `- error: 'main' attribute cannot be used in a module that contains top-level code
 5 | struct BareSwiftApp: App {
 6 |
/home/joker/Desktop/Bare-Swift/Sources/main.swift:4:1: error: 'main' attribute cannot be used in a module that contains top-level code
 1 | import Adwaita
   | |- note: top-level code defined in this source file
   | `- note: pass '-parse-as-library' to compiler invocation if this is intentional
 2 |
 3 |
 4 | @main
   | `- error: 'main' attribute cannot be used in a module that contains top-level code
 5 | struct BareSwiftApp: App {
 6 |

To Reproduce

1. Create swift package

2. Add the simple hello word text and build it

Expected behavior

Should build without error?

Additional context

No response