Uploaded image for project: 'Swift'
  1. Swift
  2. SR-4716

Better diagnostics for multifile executable without a main.swift file

    XMLWordPrintable

    Details

      Description

      $ touch file1.swift file2.swift
      $ swiftc file1.swift file2.swift
      Undefined symbols for architecture x86_64:
        "_main", referenced from:
           implicit entry/start for main executable
      ld: symbol(s) not found for architecture x86_64
      <unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
      

      The problem here is neither file is called main.swift, so the top-level-code `main` function doesn't get emitted. The compiler should check the file names and emit an error rather than going all the way through compilation to hit the link error.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            huon Huon Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: