Xcode 4 build succeeds, command line build fails?

后端 未结 10 1598
春和景丽
春和景丽 2021-01-30 02:14

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

相关标签:
10条回答
  • 2021-01-30 03:07

    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.

    0 讨论(0)
  • 2021-01-30 03:16

    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.

    0 讨论(0)
  • 2021-01-30 03:17

    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

    0 讨论(0)
  • 2021-01-30 03:18

    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/

    0 讨论(0)
提交回复
热议问题