<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<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">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/3996</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:35:00 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/3996" rel="self" type="application/rss+xml" />

		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-25280</link>
			<pubDate>Tue, 02 Feb 2010 16:12:01 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">25280@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>im having some trouble actually, your guide would be very appreciated slembcke
</p></description>
		</item>
		<item>
			<title>slembcke on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-25276</link>
			<pubDate>Tue, 02 Feb 2010 15:06:32 +0000</pubDate>
			<dc:creator>slembcke</dc:creator>
			<guid isPermaLink="false">25276@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Oof. I still need to write up a migration guide to show how to easily port the old callbacks to the new ones. I meant to do it before releasing the Chipmunk 5 stuff, but it was just one more thing to do that was holding making a release.
</p></description>
		</item>
		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23981</link>
			<pubDate>Fri, 22 Jan 2010 12:33:04 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">23981@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>thank you very much. clarity at last. :)
</p></description>
		</item>
		<item>
			<title>kalx on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23979</link>
			<pubDate>Fri, 22 Jan 2010 12:15:53 +0000</pubDate>
			<dc:creator>kalx</dc:creator>
			<guid isPermaLink="false">23979@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>If you upgraded to Chipmunk 5, the collision system was vastly improved to provide more callbacks.</p>
<p>Basically there's 4 callbacks at various stages of a collision: Begin, Presolve, Postsolve, and Separate. You are not required to implement all these, only what you need, but it gives you much more flexibility in your app.</p>
<p>The new function to add a collision handler is:<br />
<pre><code>void cpSpaceAddCollisionHandler(
        cpSpace *space,
        cpCollisionType a, cpCollisionType b,
        cpCollisionBeginFunc begin,
        cpCollisionPreSolveFunc preSolve,
        cpCollisionPostSolveFunc postSolve,
        cpCollisionSeparateFunc separate,
        void *data
)</code></pre>
<p>so if you want to continue using your old code, just use your current callback function as the Begin callback, and put NULL for the rest.</p>
<p>eg. <code>cpSpaceAddCollisionPairFunc(_gameSpace, 0, 1, &#38;spriteCollision, NULL, NULL, NULL, self);</code></p>
<p>The callback function itself has also changed slightly to:<br />
<pre><code>typedef int (*cpCollisionBeginFunc)(cpArbiter *arb, struct cpSpace *space, void *data)
typedef int (*cpCollisionPreSolveFunc)(cpArbiter *arb, struct cpSpace *space, void *data)
typedef void (*cpCollisionPostSolveFunc)(cpArbiter *arb, struct cpSpace *space, void *data)
typedef void (*cpCollisionSeparateFunc)(cpArbiter *arb, struct cpSpace *space, void *data)</code></pre>
<p>The callback setup was the only change I had to make when upgrading Chipmunk in my current Cocos 2d v0.8.2 project.</p>
<p>Make sure you have the latest Chipmunk (v5.1) which is available in the latest Cocos2d revision on SVN. In Chipmunk v5.0 a return 0 (ignore collision) in the BEGIN stage of the collision did not translate over to the rest of the stages.</p>
<p>In addition, Chipmunk 5+ also added a nice feature that basically allows you mark a shape for deletion in a collision callback. It's called a Post Step callback. As you may or may not now, you cannot delete a shape involved in a collision within a collision callback (or the app will crash), so I thought this was really nice new feature :)</p>
<p>More info on all of this can be found here: <a href="http://code.google.com/p/chipmunk-physics/wiki/CallbackSystem" rel="nofollow">http://code.google.com/p/chipmunk-physics/wiki/CallbackSystem</a></p>
<p>- kalx
</p></description>
		</item>
		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23971</link>
			<pubDate>Fri, 22 Jan 2010 10:45:31 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">23971@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>turns out it was!, im too far into a project to look at upgrading my knowledge to chipmunk 5.0, time to roll back chipmunk!
</p></description>
		</item>
		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23969</link>
			<pubDate>Fri, 22 Jan 2010 10:26:14 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">23969@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>sorry for the triple post!, i've worked out what it is, i do have the right libs in place, but my cpSpace.h and cpSpace.c don't have declarations for cpSpaceAddCollisionPairFunc</p>
<p>Was this depreciated and changed for another function in chipmunk 5.0?
</p></description>
		</item>
		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23968</link>
			<pubDate>Fri, 22 Jan 2010 09:24:03 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">23968@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ld build/Release-iphoneos/game.app/game normal armv6<br />
cd /Users/user/Documents/Games/game-tilemap<br />
setenv IPHONEOS_DEPLOYMENT_TARGET 3.1.2<br />
setenv MACOSX_DEPLOYMENT_TARGET 10.5<br />
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"<br />
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk -L/Users/user/Documents/Games/game-tilemap/build/Release-iphoneos -F/Users/user/Documents/Games/game-tilemap/build/Release-iphoneos -filelist /Users/user/Documents/Games/game-tilemap/build/game.build/Release-iphoneos/game.build/Objects-normal/armv6/game.LinkFileList -mmacosx-version-min=10.5 -dead_strip -all_load -ObjC -miphoneos-version-min=3.1.2 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation "-lcocos2d libraries" -o /Users/user/Documents/Games/game-tilemap/build/Release-iphoneos/game.app/game</p>
<p>Undefined symbols:<br />
  "_cpSpaceAddCollisionPairFunc", referenced from:<br />
      -[ControlLayer init] in ControlLayer.o<br />
ld: symbol(s) not found<br />
collect2: ld returned 1 exit status</p>
<p>this is the error im getting, ive looked on google and someone things this is a missing lib error? but i cant tell which
</p></description>
		</item>
		<item>
			<title>Bongeh on "chipmunk error? Undefined symbols:&quot;_cpSpaceAddCollisionPairFunc&quot; referenced from"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3996#post-23967</link>
			<pubDate>Fri, 22 Jan 2010 09:06:18 +0000</pubDate>
			<dc:creator>Bongeh</dc:creator>
			<guid isPermaLink="false">23967@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have this error popping up every time i try to compile and i'm not sure what is causing it. i have the following code in my init</p>
<p>cpSpaceAddCollisionPairFunc(_gameSpace, 0, 1, &#38;spriteCollision, self);</p>
<p>and this code above the implementation of my scene</p>
<p>static int spriteCollision(cpShape *a, cpShape *b, cpContact *contacts, int numContacts, cpFloat normal_coef, void *data) {</p>
<p>		NSLog(@"collision detected!");</p>
<p>	return 1;<br />
}</p>
<p>ive got 2 sprites in the scene, with collision types 0 and 1 on them, i've given them shape data and added it to the gamespace</p>
<p>I'm completely stumped!
</p></description>
		</item>

	</channel>
</rss>

