无法打开可执行文件 - xcode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8746194/
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-14 22:54:34  来源:igfitidea点击:

Unable to open executable - xcode

iphoneobjective-ciosxcodexcode4

提问by Filipe Mota

I'm getting this error...any idea how to solve it?

我收到此错误...知道如何解决吗?

GenerateDSYMFile /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app.dSYM /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest
    cd /Users/fmota/Documents/Developer/Protobuf/PBTest
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/usr/bin/dsymutil /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest -o /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app.dSYM

error: unable to open executable '/Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest'

采纳答案by Manobala

I have also faced that problem. I have closed, restarted Xcode; deleted the application from device and reinstalled it again, then the problem has gone.
Make sure the library and project files is truly included if it is not include it shows in red color in this type of case some time it is in original folder and not in project so delete it and add it again.

我也遇到过这个问题。我已经关闭,重新启动 Xcode;从设备中删除应用程序并重新安装,然后问题就消失了。
确保库和项目文件确实包含在内,如果不包含它在这种情况下显示为红色,有时它在原始文件夹中而不是在项目中,因此将其删除并再次添加。

回答by Josh Liptzin

In my case I had accidentally #imported the implementation file of a class instead of the header file (#import "MyClass.m" instead of #import "MyClass.h"). Unfortunately the error message for this innocent mistake is the opposite of helpful.

在我的例子中,我不小心#import了一个类的实现文件而不是头文件(#import“MyClass.m”而不是#import“MyClass.h”)。不幸的是,这个无辜错误的错误信息与有用的相反。

回答by HymanyJohnson

I might be a lil' late to this party, but same problem, solved it by going to Product > Scheme > Manage Schemes... Then simply delete current scheme and recreate a new one then try building again.

我可能会迟到这个派对,但同样的问题,通过转到产品> 方案> 管理方案解决了它...然后只需删除当前方案并重新创建一个新方案,然后再次尝试构建。

This is a good way of resetting any compilation settings you might have inadvertently changed.

这是重置您可能无意中更改的任何编译设置的好方法。

回答by sarabdeep singh

In my case, I was trying to compile external library into my code and some of test c files in this library was added on "Compile Sources" on "Build Phases" tab. These files also had main() function which was causing it show "duplicate symbol" message. Once I removed these files from Compile Sources, project compiled successfully.

就我而言,我试图将外部库编译到我的代码中,并且在“构建阶段”选项卡上的“编译源”中添加了该库中的一些测试 c 文件。这些文件还具有 main() 函数,导致它显示“重复符号”消息。从编译源中删除这些文件后,项目编译成功。

回答by puzzl

And here's yet another cause: repeated use of [unowned self] inside of nested blocks.

这是另一个原因:在嵌套块内重复使用 [unowned self]。

回答by software evolved

Another thing to check -- if you have "Continue build after errors" set to YES, then a compile error (which you may have missed in the issue pane) can eventually lead to this error. Fix the compile error to resolve it.

另一件要检查的事情——如果您将“错误后继续构建”设置为“是”,那么编译错误(您可能在问题窗格中错过了)最终会导致此错误。修复编译错误以解决它。

回答by Craig Conover

I had accidentally added the same source files to my Project in Xcode twice (a header and an implementation file. Look for clues in the error message as to which files might be duplicates.

我不小心将相同的源文件两次添加到我的 Xcode 项目中(一个头文件和一个实现文件。在错误消息中查找有关哪些文件可能重复的线索。

Deleting the duplicate copy (Remove References, not Move to Trash) solved my issue.

删除重复副本(删除引用,而不是移至垃圾箱)解决了我的问题。

回答by Jeanne

I solved this by deleting the path specified in both Header Search Paths and Library Search Paths, found under Targets - Build Settings - Search Paths. The application now builds and runs cleanly on the iOS simulator.

我通过删除在目标 - 构建设置 - 搜索路径下找到的标题搜索路径和库搜索路径中指定的路径解决了这个问题。该应用程序现在可以在 iOS 模拟器上构建和运行。

I do not yet have real-device testing capability, so we'll see what happens when I get to that point.

我还没有真正的设备测试能力,所以当我到达那个点时我们会看到会发生什么。

回答by puzzl

I was getting the same error dialog. It turns out I had two consts of the same name declared in different files and the compile was failing with no meaningful error output, only this problem. After doing the DWARF thing discussed hereI was able to get better error output that helped me find the problem

我收到了同样的错误对话框。结果我在不同的文件中声明了两个同名的常量,编译失败,没有有意义的错误输出,只有这个问题。在做了这里讨论的 DWARF 事情之后,我能够获得更好的错误输出,帮助我找到问题