Xcode 10 错误:链接器命令失败,退出代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52377072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:46:07  来源:igfitidea点击:

Xcode 10 Error: linker command failed with exit code 1

swiftxcodexcode10

提问by ap123

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

我刚刚将我的 Xcode 更新为 Xcode 10,现在我的项目将无法运行,并且出现错误:

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

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?

我不知道这意味着什么以及如何解决它。我试着到处谷歌搜索答案,但一无所获。我怎样才能解决这个问题?

回答by yze

Open the projectname.xcworkspaceif you are using cocoapods not the projectname.xcodeproj.

如果您使用的是 cocoapods 而不是projectname.xcodeproj,请打开projectname.xcworkspace。

Alternatively, using terminal

或者,使用终端

$ open projectname.xcworkspace

$打开项目名称.xcworkspace

enter image description here

在此处输入图片说明

Hope this helps.

希望这可以帮助。

回答by Matt Parkins

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.

我今天在 C++ 中遇到了这个问题,在一个不使用 pod 的项目中使用了新升级的 Xcode 10,这与其他答案不同。

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

在此处输入图片说明

回答by user798719

go to your project directory in the terminal

转到终端中的项目目录

Type:

类型:

pod deintegrate
pod install

回答by Lean van Heerden

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.

在您的项目中,打开 Project Navigator,然后展开 Frameworks 文件夹。您将看到文件 -lstdc++.6 以红色突出显示,删除它,重建您的项目,您就可以开始了。

回答by Ka-h Truong

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!

您可以打开RN..xcworkspace,然后展开 Frameworks 文件夹。你会看到红色突出显示的文件,删除它,学习构建并重建项目,这个问题就解决了。咕咕咕!

回答by midhun p

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

请使用 cocoapods 进行依赖管理,如果您已经在使用它,则删除所有 Pod 并再次添加它/更新所有 Pod

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

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