Search code examples
iosxcode4workspace

Workspace with Kal and 1 other project will not build (undefined symbols for i386)


I have a iPad app using XCode4 with Storyboards, that has a Tab Bar controller and two UIViews (one of which is the KalCalendarController), all in a workspace. I have added Kal to it, so now I have two projects in the workspace. When I add the 2 lines of sample code from the Kal doc, I get this error:

    Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_KalViewController", referenced from:
      objc-class-ref in KalCalendarController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is the 2 lines of code:

KalViewController *calendar = [[KalViewController alloc] init];
[self.navigationController pushViewController: calendar animated:YES];

I have looked at almost all of the SO questions for "symbols not found..." and none of them apply to this particular situation. I am able to get the Kal example to work, but not in the workspace. I have checked the Linker settings, and they appear to be correct. Where else should I check to solve this?


Solution

  • Assuming you've linked and included the framework/library properly, one problem may be that the Kal project's target settings don't include the right platforms in the Architectures setting under "Build Settings" tab.

    Based on your first comment above, it's also possible you haven't linked/included Kal at all. Simply dragging it into a workspace is not sufficient. You need to link to it from your main application (you can do this under the Summary tab for your app's target settings).

    This relies on Xcode's "automagic" detection of dependencies, which doesn't always work as advertised. In this case, you may need to turn off automatic dependencies in your main app's scheme and set the dependencies manually under the scheme's Build settings so that Kal is built first, then your app.