Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 - Error Starting Executable

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

like image 738
The Maniac Avatar asked Mar 10 '11 22:03

The Maniac


5 Answers

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.

like image 121
Joshua Nozzi Avatar answered Nov 06 '22 13:11

Joshua Nozzi


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.

like image 37
Alex Zavatone Avatar answered Nov 06 '22 11:11

Alex Zavatone


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...

like image 34
Kenny Winker Avatar answered Nov 06 '22 13:11

Kenny Winker


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.

like image 29
Surpher Avatar answered Nov 06 '22 12:11

Surpher


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)

like image 24
Jay Avatar answered Nov 06 '22 13:11

Jay