Xcode 4 - 启动可执行文件时出错
我一直在 Xcode 3.2.5 中开发一个项目,今天我尝试将其迁移到 Xcode 4.0。它编译得很好;我可以顺利导航到并执行 .app(如预期)。唯一奇怪的是 Xcode 无法启动该应用程序,并在尝试时显示以下错误:
“启动可执行文件时出错。未指定可执行文件。使用“file”或“exec-file”命令”(图片不可用)
我已经搜索了项目和 Xcode 设置,并在谷歌上搜索了半天,但我所能找到的都是死胡同,人们抨击其他人违反了 Apple NDA。仅供参考,Xcode 4 已发布,并且不再受 NDA 约束。
我应该开始一个新项目并复制我的源代码吗?对我来说听起来不对,但是当蛮力起作用时,蛮力就起作用。
提前致谢
I've been working on a project in Xcode 3.2.5 and today I tried migrating it up to Xcode 4.0. It compiles just fine; I can navigate to and execute the .app without a hitch (as expected). The only thing that is screwy is the fact that Xcode cannot launch the application, and displays the following error when it tries:
"Error starting executable. No executable file specified. Use the "file" or "exec-file" command" (image not available)
I've scoured the Project and Xcode settings and have been googling for half the day, but all I can find are dead ends and people bashing other people about breaking Apple NDA. FYI Xcode 4 has been released, and is no longer under NDA.
Should I just start a new project and copy in my source? Sounds wrong to me, but brute force works when brute force works.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我在将项目从 Xcode 4 迁移到 4.1 时遇到了这个问题,最终是由于目标的“产品名称”在调试和发布配置中不同。这是我在许多版本之前更改产品名称时遗留下来的。所以检查一下...
I had this issue when migrating a project from Xcode 4 to 4.1, and it ended up being due to the Target's "Product Name" being different in the debug and release configurations. A holdover from when I changed the name of the product many versions ago. So check that...
我将 Xcode 从 4.2 降级到 4.1,却在设备上构建和运行时遇到错误:“启动可执行文件时出错。不知道如何运行...”。我已经清理了项目(Xcode > Project > Clean)并清理了构建文件夹(Xcode > Project >(按住 option 键)清理构建文件夹)。之后我不得不再次构建,它在运行 iOS 5 的 iPod touch 4g 上构建得很好。
I've downgraded Xcode from 4.2 to 4.1 only to encounter an error at build and run on device: "Error starting executable. Don't know how to run ...". I've cleaned the project (Xcode > Project > Clean) and cleaned the build folder (Xcode > Project > (hold option key) Clean Build Folder). After that I had to build again and it built okay on iPod touch 4g running iOS 5.
嗯,听起来确实像是该错误消息背后的一系列错误!
我第一次在 4.2.x 下加载 Xcode 3 项目后出现错误。
上述技巧对我来说都不起作用,但我最终所做的是从 GDB 切换到 LLDB。
这解决了它。
看起来 GDB 无法正确识别可执行文件的新路径(即曾经在 Xcode3 中位于本地 PROJECT/build/Debug/...,但现在位于 Xcode 的常用临时文件夹位置4 它仍在相对于项目源的构建文件夹中寻找可执行文件)
Well, it sure sounds like a whole family of bugs behind that error message!
I got the error after loading up an Xcode 3 project under 4.2.x for the first time.
None of the above tips worked for me, however what I eventually did was switching from GDB to LLDB.
That fixed it.
It looked like the new path to the executable wasn't properly recognized by GDB (i.e. once locally at PROJECT/build/Debug/... in Xcode3 but now in the usual temp. folder location with Xcode 4 it was still looking for the executable in the build folder relative to the project sources)
我复制了目标并将复制的目标重命名为不同的名称,我收到此错误消息。我所做的是清理项目,退出 Xcode,重新启动 Xcode,然后它就可以在我的设备上运行。
I duplicated the target and rename the copied on to different name, I got this error message. What I did is to clean the project, exit Xcode, restart the Xcode, then it can run on my device.
据猜测,它根据您的 v3 目标和构建设置为您设置的方案可能不太正确。从方案菜单中,选择编辑当前方案,然后从列表中选择运行操作并确保选择了适当的可执行文件。
At a guess, the schemes it set up for you based on your v3 targets and build settings might not be quite right. From the schemes menu, choose to edit the current scheme, then select the Run action from the list and make sure the appropriate exectuable is selected.
我遇到了同样的问题,所以我花时间识别问题,重现问题,缩小范围,并尽我所能解释如何不让它发生 - 以及问题带来的普遍挫败感像这样(两周内我使用了 2 个不同版本的 Xcode)。
如果您要删除我的帖子,那么至少花点时间尝试回答我曾经尝试过的问题。
现在,我们的回复实际上说明了如何创建此问题以及如何避免此问题。
我刚刚在为 iOS 创建应用程序时遇到了这种情况。为什么?我重命名了我的目标可执行文件。
只是通过检查源的新副本并重建来测试这一点。
该应用程序在我的设备上运行良好。
进入Xcode 4.2,重命名目标。运行应用程序。 “启动可执行文件时出错...”
我改回了文件名。同样的错误。
清理并再次运行应用程序并启动。
重命名该应用程序,清理并再次运行它。没有那么幸运。
不要通过重命名目标来重命名您的应用程序。
这是一个非常愚蠢的限制。 Apple 允许您重命名目标应用程序,但这样做会阻止您的应用程序在设备上启动。
编辑:我还没有签入任何代码,但现在我无法签出并构建和运行任何应用程序而不发生这种情况。一旦您进入设备/xCode,如何使设备/xCode 脱离这种状态?
即使应用程序现在在 int retVal = UIApplicationMain(argc, argv, nil, nil); 处启动时也会崩溃。
这是 Snow Leopard 上的 Xcode 4.2 中的情况,但上周我在另一台机器上的 Xcode 3 中也进入了相同的状态。
编辑2:重新启动设备,重新启动我的Mac。首先在模拟器中构建并运行,然后在 Gen4 iPod touch 上构建并运行。有用。
I ran into the same issue this question came up so I spent my time identifying the issue, reproducing the issue, narrowing it down and explaining as best I could how to not make it happen - as well as the general frustration that comes with an issue like this (it hit me on 2 different versions of Xcode in 2 weeks).
If you're going to delete my post then at least take the time to try and answer the question as I had tried to do.
Now, on to the reply that actually tells how this issue may be created and how to avoid that.
I JUST had this happen creating an app for iOS. Why? I renamed my target executable.
Just tested this by checking out a new copy of the source and rebuilding.
The app ran fine on my device.
Went in to Xcode 4.2, renamed the target. Ran the app. "Error starting Executable..."
I changed the filename back. Same error.
Cleaned and ran the app again and it launched.
Renamed the app, cleaned and ran it again. Not so much luck.
Don't rename your app by renaming the target.
This is such a stupid limitation. Apple lets you rename your target app, but by doing so, this prevents your app from launching on the device.
EDIT: I haven't checked in any code, but now I can't check out and build and run any app without this happening. How do you get the device/xCode out of this state once you've gotten it in to it?
Even the app now crashes on launch at int retVal = UIApplicationMain(argc, argv, nil, nil);
This is in Xcode 4.2 on Snow Leopard, but I got into the same state with Xcode 3 on another Machine last week.
Edit 2: Rebooted the device, rebooted my Mac. Built and ran in the simulator first, then on the Gen4 iPod touch. It works.