bear
bear

Reputation: 11605

Undefined symbols in Xcode

I'm getting this error when building in Xcode for iOS.

Undefined symbols for architecture i386:
"_CGRectInset", referenced from:
  -[RootViewController viewDidLoad] in RootViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The app is a clean project, just built from the template Xcode provides.

Any ideas?

Upvotes: 5

Views: 5923

Answers (2)

algal
algal

Reputation: 28094

I had the same problem with a project created from "Page-Based Application" template, in XCode4 Developer Preview 5.

You can fix it by adding the CoreGraphics framework to the list of linked frameworks and libraries. In other words:

  1. Select the project file in the navigator (left-pane)
  2. select the app target (the only other one is a testing target)
  3. In the summary tab, scroll down to "Linked Frameworks and Libraries"
  4. Hit the + andd CoreGraphics.framework.

Then it builds and runs.

Upvotes: 4

Alex Nichol
Alex Nichol

Reputation: 7510

This may be due to the project not being linked to the correct libraries. It may also be that there are missing Frameworks on your SDK installation. In the Build Phases section, make sure that your app is linking with UIKit and CoreGraphics. Also, it may help to also add the QuartzCore Framework, although I doubt that that is needed.

Upvotes: 2

Related Questions