<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Linking Error: CGRectZero and CGRectOffset</title>
	<atom:link href="http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html</link>
	<description>iOS and Objective-C Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Tue, 22 May 2012 11:53:47 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: jayesh</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-64753</link>
		<dc:creator>jayesh</dc:creator>
		<pubDate>Thu, 22 Dec 2011 10:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-64753</guid>
		<description>Remove your Framework and exit xcode...then start xcode now import the framework and clean all targets...and dependencies and Run
i think this can help...</description>
		<content:encoded><![CDATA[<p>Remove your Framework and exit xcode&#8230;then start xcode now import the framework and clean all targets&#8230;and dependencies and Run<br />
i think this can help&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leandro</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-45</link>
		<dc:creator>Leandro</dc:creator>
		<pubDate>Mon, 15 Sep 2008 03:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-45</guid>
		<description>You need to add the CoreGraphics.framework in Xcode doing this:
Do Right-Click in the Frameworks folder and Add.. -&gt; Existing Frameworks...
and select this folder:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks/CoreGraphics.framework 

That worked for me.</description>
		<content:encoded><![CDATA[<p>You need to add the CoreGraphics.framework in Xcode doing this:<br />
Do Right-Click in the Frameworks folder and Add.. -&gt; Existing Frameworks&#8230;<br />
and select this folder:</p>
<p>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks/CoreGraphics.framework </p>
<p>That worked for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: datasmid</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-37</link>
		<dc:creator>datasmid</dc:creator>
		<pubDate>Mon, 25 Aug 2008 21:15:31 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-37</guid>
		<description>Try a compile to the device, the simulator might not be up to it.</description>
		<content:encoded><![CDATA[<p>Try a compile to the device, the simulator might not be up to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-36</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Thu, 21 Aug 2008 05:39:27 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-36</guid>
		<description>The header files are used only during parsing to define stuff, they have no direct effect on the linking stage. Once the code generation is complete your object files contain a number of references to symbols that are provided by other object files. A framework is essentially a collection of object files. A symbol can be a global variable or the implementation of a method or even an old fashioned function.

When you use a symbol defined in a framework the linker resolves that symbol by including the code block associated with it and that may include references to symbols that are as yet undefined. That is what has happened in your case, you have used a method that references CGRectZero, the underscore is added during code generation so that it&#039;s symbols never conflict with symbols created by people.

Frameworks are dynamically linked libraries so that the code isn&#039;t actually included but it&#039;s easier to understand if you ignore that fact. The fact that the code in the framework has an unresolved reference is noted by the linker which tries to resolve that symbol.

You can use the CLI command nm to examine the symbols included in a framework. The man page refers to sections and they aren&#039;t that obvious, the text section is read only and contains mainly code but can contain constants, the data section is initialized global variables and the bss section is unititalized global variables.

nm /System/Library/Frameworks/AppKit.framework/AppKit
reveals that the framework AppKit has a unresolved reference to strncpy which is provided by libc. I doubt that you include the header where strncpy is defined although it&#039;s hard to be sure but that doesn&#039;t affect the linker, if you use code in AppKit that uses strncpy then the linker will resolve it by including it from libc.</description>
		<content:encoded><![CDATA[<p>The header files are used only during parsing to define stuff, they have no direct effect on the linking stage. Once the code generation is complete your object files contain a number of references to symbols that are provided by other object files. A framework is essentially a collection of object files. A symbol can be a global variable or the implementation of a method or even an old fashioned function.</p>
<p>When you use a symbol defined in a framework the linker resolves that symbol by including the code block associated with it and that may include references to symbols that are as yet undefined. That is what has happened in your case, you have used a method that references CGRectZero, the underscore is added during code generation so that it&#8217;s symbols never conflict with symbols created by people.</p>
<p>Frameworks are dynamically linked libraries so that the code isn&#8217;t actually included but it&#8217;s easier to understand if you ignore that fact. The fact that the code in the framework has an unresolved reference is noted by the linker which tries to resolve that symbol.</p>
<p>You can use the CLI command nm to examine the symbols included in a framework. The man page refers to sections and they aren&#8217;t that obvious, the text section is read only and contains mainly code but can contain constants, the data section is initialized global variables and the bss section is unititalized global variables.</p>
<p>nm /System/Library/Frameworks/AppKit.framework/AppKit<br />
reveals that the framework AppKit has a unresolved reference to strncpy which is provided by libc. I doubt that you include the header where strncpy is defined although it&#8217;s hard to be sure but that doesn&#8217;t affect the linker, if you use code in AppKit that uses strncpy then the linker will resolve it by including it from libc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-13</link>
		<dc:creator>john</dc:creator>
		<pubDate>Sat, 16 Aug 2008 15:30:21 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-13</guid>
		<description>Thanks Michael. 

CGRectZero is defined in CGGeometry.h and I didn&#039;t specifically include that file. CGRectZero is listed as a global C variable in the documentation set as part of the core library, so does that explain why I don&#039;t need to import the header in order for the compiler to understand the reference to CGRectZero in my code?</description>
		<content:encoded><![CDATA[<p>Thanks Michael. </p>
<p>CGRectZero is defined in CGGeometry.h and I didn&#8217;t specifically include that file. CGRectZero is listed as a global C variable in the documentation set as part of the core library, so does that explain why I don&#8217;t need to import the header in order for the compiler to understand the reference to CGRectZero in my code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://MobileDeveloperTips.com/xcode/linker-error-cgrectzero-and-cgrectoffset.html#comment-12</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 16 Aug 2008 08:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=149#comment-12</guid>
		<description>Strictly speaking the compiler didn&#039;t resolve the reference, it is the linker&#039;s job to resolve references to code.
The 3 steps in compilation are
parse
generate
link

The first step creates a machine readable copy of your code and it is the only one interested in your header files. The second step takes the output of the first step and creates the machine code needed to implement your logic and the final step copies the code you need from frameworks. The third step isn&#039;t always performed, when you create a framework for example. It is also only done once during the compilation of your program even if you have hundreds of source code files.

The linker (ld) goes through all the object (.o) files generated in step 2 and creates a list of unresolved references that it tries to find in the frameworks, the included frameworks in turn have unresolved references that are resolved in the same way. Finally just to make things more complicated some references are resolved at run time although the linker needs to know that they can be resolved.

/Michael</description>
		<content:encoded><![CDATA[<p>Strictly speaking the compiler didn&#8217;t resolve the reference, it is the linker&#8217;s job to resolve references to code.<br />
The 3 steps in compilation are<br />
parse<br />
generate<br />
link</p>
<p>The first step creates a machine readable copy of your code and it is the only one interested in your header files. The second step takes the output of the first step and creates the machine code needed to implement your logic and the final step copies the code you need from frameworks. The third step isn&#8217;t always performed, when you create a framework for example. It is also only done once during the compilation of your program even if you have hundreds of source code files.</p>
<p>The linker (ld) goes through all the object (.o) files generated in step 2 and creates a list of unresolved references that it tries to find in the frameworks, the included frameworks in turn have unresolved references that are resolved in the same way. Finally just to make things more complicated some references are resolved at run time although the linker needs to know that they can be resolved.</p>
<p>/Michael</p>
]]></content:encoded>
	</item>
</channel>
</rss>

