3

I know this is a long shot but, I've been having trouble with a linker error that I specifically don't understand. Please refer to the picture below.

enter image description here

The project contains 4 targets. This error points specifically to one target that is a BSD/Shell helper tool written in c.

I'm sorry for being vague, as I don't fully understand what might be the problem. Any suggestions? Thank you.

David
  • 14,205
  • 20
  • 97
  • 144
  • Has the source file that defines `main()` been added to the helper tool target? –  May 07 '11 at 02:05
  • Yes, the helper tool is one `.m` file that has `main()` defined in it. – David May 07 '11 at 02:08
  • Are you able to build the helper tool without using Xcode? –  May 07 '11 at 02:09
  • I know the helper tool once worked because I've used it before in another project. I haven't made any changes to it since. This was in Xcode3. I am now using the same tool in Xcode4. I've noticed that the BSD/Shell app is now renamed to `Command line tool` in Xcode4. I'm assuming it is the same thing. – David May 07 '11 at 02:15
  • 2
    In the build setting, I've always had it at `i386` and `x86_64` architectures. I just removed the helper tool and went through the same laborious task of putting back into the project and it `magically` fixed itself. I don't really know, why. Perhaps it was a check box that I didn't check initially. Anyways the error is gone now. Thank you for the help. – David May 07 '11 at 02:27

2 Answers2

2

Usually, this means that the source file that defines main() hasn’t been added to the corresponding target.

Another possible reason is that the source file that contains main() is being compiled for an architecture (e.g. i386 only) but the target/executable specifies a different architecture (e.g. x86_64 only or fat/universal).

One strategy to help with diagnosing this issue is running xcodebuild against your project+target to inspect the commands that are being issued to compile and link the target.

When all else fails, remove the target and add it again.

0

Did you #include the appropriate files?

Alexsander Akers
  • 15,967
  • 12
  • 58
  • 83