The error cannot find auto-link library XCTest and XCTestSwiftSupport?

This morning I updated my mac and then updated Xcode to 11.4.
And then I opened my project (changed nothing, but built successfully yesterday).
It shows the error "Could not find or use auto-linked library 'XCTestSwiftSupport' ld: warning: Could not find or use auto-linked framework 'XCTest'"
Do you meet the weird issue?
I found the linkerror to link static libraries


I have faced with the same issue none of found solutions are working.

I have the exact same issue, and I haven't found any solution so far.
I have a full swift project which is building nicely with Xcode 11.3.1

1 Like

In my case settings ENABLE_TESTING_SEARCH_PATHS to YES fixed the issue.


Thanks @georgescumihai; that worked! I experienced this issue after I added a custom extension to Apple's XCTestCase class in a library that I created. How did you discover this solution? Is there a reference article somewhere with more details on all of these build settings?


that works for me too. thx

Don't remember exactly, most likely stackoverflow.

The actual solution is to exclude test sources from main targets build. For Xcode 12.04 select target / Build Phases / Compile Sources and remove the test classes.

The test classes should be only in the test Target


Yey! It's done! Thanks :)

That works too! Thanks

I added ViewInspector library by SPM and selected main target instead of test target, same problem happened. Thanks to @yerlibilgin , I re-add the library and select correct target, after that i can check at Build Phases > Link Binary With Libraries for both targets.


Worked perfectly for me

Awesome, this is the actual fix. Thanks man!

Thank you for this! Makes so much sense now.