I have a project in Xcode 4 (the latest non-beta version) that builds fine when built in Xcode itself. Specifically, the Ld command correctly uses the derived data directory (wh
I don't know if this will work for you but in my case, I had more than one main.m
file. All I had to do was detach one of the main.m
from the target and it worked. Make sure you don't have more than one main.m
in your project.
I got this error when I was experimenting with my files I add the @implementation to the .h file and left the .m file empty. I don't believe this is your error but if anyone else gets it maybe check that you haven't done this.
If you look at the log of the build, asking to see all messages, you should see a terse line that says "link ..." that has little in the way of details. However if you right click that line and select "expand all transcripts" you get a very detailed line telling you what command was issued from within XCode.
That should help you to debug the issue.
Dave
I ran in to the same issue yesterday and was able to work it out. In an effort to narrow down what worked for James, I'll point to what I had to do. I had to add a workspace and switch to running xcodebuild with workspace/scheme instead of project/target.
Using workspace/scheme forced xcodebuild to use the DerivedData folder instead of the build output folder under the main project. This allowed the linker to find the associated static library.
This blog post was hugely helpful:
http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/