10

I just updated my Xcode to Xcode 10 and now my project will not run and I get the error:

ld: library not found for -lstdc++.6 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I do not know what this means and how to fix it. I tried googling everywhere for the answer and came up with nothing. How can I fix this?

ap123
  • 916
  • 1
  • 8
  • 22
  • 2
    Turns out that there is some file in my Xcode project under Frameworks -> System Frameworks that was labeled lstdc++.6 I just deleted it and it works now but I have no idea what that file did – ap123 Sep 19 '18 at 19:50
  • Same for me (had the same error, removed the library and rebuilt with no issues). I also have no clue why that was added after updating to XCode 10 but thanks for posting. Happy coding. – Ibdakine Dec 27 '18 at 19:58

6 Answers6

10

Open the projectname.xcworkspace if you are using cocoapods not the projectname.xcodeproj.

Alternatively, using terminal

$ open projectname.xcworkspace

enter image description here

Hope this helps.

yveszenne
  • 666
  • 8
  • 18
  • This is an interesting because I press on the _.xcworkspace_ file to get to xcode, but when I go to my recents in finder, the _.xcodeproj_ is there. Im not sure if this means that Xcode is automatically opening the other one? – ap123 Sep 18 '18 at 05:06
  • Yes, just make sure to close individually the open projects before quiting xcode(cmd + q). Sometimes when you open your xcode it will open the previous .xcodeproj and putting xcworkspace behind. If this helps you pls accept it as the answer. Good luck – yveszenne Sep 18 '18 at 05:16
  • 3
    Tried it and it did not work when using _.xcworkspace_ – ap123 Sep 18 '18 at 18:51
5

I had this problem today in C++ using a newly upgraded Xcode 10 in a project that does not use pods, unlike the other answers.

When I clicked on the linker error there were no details given. This stumped me for a while and then I realised you can right-click the linker error and click "reveal in log".

In my case it was just a function that I had renamed-but-not-updated-all-the-references-to-it causing a linker error, but the real problem was that the linker error details were not being shown when the error occurred.

enter image description here

Matt Parkins
  • 24,208
  • 8
  • 50
  • 59
3

go to your project directory in the terminal

Type:

pod deintegrate
pod install
user798719
  • 9,619
  • 25
  • 84
  • 123
  • you might try typing: pod update as well. This error is very general and could be cause for a variety of reasons. Unfortunately, you'll need to provide more information, perhaps starting with your podfile. Do you have any sense of which cocoa pods dependency / library / framework might be causing the issue? What I would do is start with one dependency and build the project. If that works, add another one. If that works, add a third one, and so forth. – user798719 Sep 18 '18 at 05:05
  • Unfortunately doing ``pod update`` does not work at all. When I remove a pod then build my project I get other errors because there's code in my view controllers etc that's connected to it. Is there a way to remove the pods and just see if I get the ``library not found for -lstdc++.6`` error? – ap123 Sep 18 '18 at 05:09
  • sometimes it's easiest to just start over. I might do a pod deintegrate. Then hit a command K (clean project). Close the project. Maybe even delete the cache. And see if you can build the project. If your code requires a pod, then it won't build because it needs access to that library. But if you are saying you want to just test your basic code without 3rd party dependencies this is how you'd do it. Did you save a good recent checkpoint with git? If so I'd just revert to that and start over from there. We've all been there. – user798719 Sep 18 '18 at 05:15
2

In your project, open the Project Navigator, and expand the Frameworks folder. You will see the file -lstdc++.6 highlighted in red, delete it, rebuild your project and you're good to go.

Lean van Heerden
  • 882
  • 9
  • 20
1

You can open the RN..xcworkspace, and expand the Frameworks folder. You will see the file highlighted in red, delete it, Learn the build and rebuild the project, This problem will be resolved. goog cluck!

0

please use cocoapods for dependency management, if you already using it then remove all pods and add it again / update all pods

https://stackoverflow.com/a/52050043/9978212

midhun p
  • 1,987
  • 18
  • 24