4

I am working in swift with Xcode 7.3.1. Now i got error showing like file name used twice and i am stuck with this following error.

<unknown>:0: error: no such file or directory: '/Users/mac/Desktop/develop/myApp/Manager.swift'
<unknown>:0: error: filename "Manager.swift" used twice: '/Users/mac/Desktop/develop/myApp/Manager.swift' and '/Users/mac/Desktop/develop/myApp/MyApp/module/Manager.swift'

Could you please help me

IKKA
  • 6,297
  • 7
  • 50
  • 88
  • [http://stackoverflow.com/questions/34838184/xcode-swift-filename-used-twice-build-error](http://stackoverflow.com/questions/34838184/xcode-swift-filename-used-twice-build-error) – Ketan Parmar Jul 28 '16 at 04:46
  • @Lion I already tried with above link. Its not working. – IKKA Jul 28 '16 at 04:49
  • You have path already, you can go to that folder and can delete duplicate file!! – Ketan Parmar Jul 28 '16 at 04:53
  • Try This. Open your project folder and open DerivedData folder after that select ModuleCache folder and delete it. Take a backup first. Hope it help – Abdul Rehman Jul 28 '16 at 04:58
  • And also clean the project by pressing these keys "option+command+shift+K" and then build the project. – Abdul Rehman Jul 28 '16 at 05:05
  • I solve it by [Remove the used twice file from Compile Sources](https://stackoverflow.com/a/48339399/6521116). Refer to [Xcode/Swift 'filename used twice' build error](https://stackoverflow.com/q/34838184/6521116) – LF00 Jan 19 '18 at 10:55

2 Answers2

1

I had a very similar issue, so hopefully this helps.

Open your project file (ProjectName.xcodeproj) in a text editor (I chose Sublime), and then search for the file entry (Manager.swift). If you find two entries for it in there, then delete one. If you are not sure if you will delete the right one, you can delete both and then re-add the file to your project afterwards.

Since you are editing your project file, it is highly recommended to make sure you have a fresh commit prior to this to avoid any potential loss of data.

CodeBender
  • 35,668
  • 12
  • 125
  • 132
0

I had actually the same problem. I found solution in Recovered References folder. Just removed reference to FileThatUsedTwice.swift Hope it will help you

Timur
  • 1
  • 1