Linker command failed with exit code 1 error in Xcode project

后端 未结 21 3118
死守一世寂寞
死守一世寂寞 2021-02-13 06:44

I was working on my project and suddenly after editing the code and compiling gave this error:

ld: warning: directory not found for option \'-
L/Use

相关标签:
21条回答
  • 2021-02-13 07:24

    The only way we can get past this bug on our project is to do a Clean and then build for iPad Retina. After that it will build successfully for any device. Weird.

    0 讨论(0)
  • 2021-02-13 07:26

    If this happens to you with CoreData generated classes, combine the +CoreDataProperties and +CoreDataClass into the +CoreDataProperties class and delete the +CoreDataClass. Make sure to search Derived Data for leftovers of the +CoreDataClass. Even after deleting the Derived Data and cleaning I sometimes had Xcode just generate the +CoreDataClass again and again. Deleting it manually in Finder and then re-bulding helped me solve this.

    0 讨论(0)
  • 2021-02-13 07:27

    I was importing a library in a test case which I had specified in my pod file for the main target but not for the test target.

    0 讨论(0)
  • 2021-02-13 07:27

    Faced similar issue, while running the code on a simulator, tried all the above mentioned options, still got the same error. Tried connecting the iOS device and build the code, it worked for us. This can be a quick workaround.

    0 讨论(0)
  • 2021-02-13 07:30

    I tried several of the answers listed but none worked for me. I got the error after updating XCode (while it was still open which may have contributed to the problem)

    First, I deleted my Derived Data folder: XCode => Preferences => Locations => Double Click on arrow next to path indicating where the Derived Data folder is. Then "Move to Trash" I don't think that's what the problem was, but it's amazing how many times this has been an issue for me working on different problems.

    Second, I 'Quit' the simulator.

    Third, I 'Quit' XCode.

    Fourth, I opened up my project in XCode again and then did a Clean and Build (found in the Product menu)

    Fifth, I ran my project and it worked fine

    0 讨论(0)
  • 2021-02-13 07:32

    In case this comes in useful for anyone else--I just had this same error, and turns out the cause was initializing a variable in my header file rather than in the main file.

    0 讨论(0)
提交回复
热议问题