[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - can't get rid of warning on cpSpaceAddCollisionPairFunc

can't get rid of warning on cpSpaceAddCollisionPairFunc

Official forum for the .

can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby nino » Sat Mar 21, 2009 12:27 pm

I'm on xCode 3.1.2 trying to build my project but I can't seem to get rid of a warning on arg 4 of cpSpaceAddCollisionPairFunc, where you pass the collision function. It works fine but I am fussy about clean builds so I want to make the warning go away.

I have tried it with and without the & and using int and cpCollFunc as the return type for my function. What am I doing wrong?

edit: the warning is incompatible pointer type.
nino
 
Posts: 9
Joined: Thu Nov 22, 2007 8:21 am

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby slembcke » Sun Mar 22, 2009 12:50 pm

That almost certainly means that the function you are trying to pass does not take the correct number/type of parameters. Check it against the type defined in the header.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby nino » Mon Mar 23, 2009 7:00 pm

nino
 
Posts: 9
Joined: Thu Nov 22, 2007 8:21 am

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby Buschmaster » Mon Mar 23, 2009 7:16 pm

Buschmaster
 
Posts: 71
Joined: Sat Dec 20, 2008 12:16 pm
Location: Minnesota

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby nino » Mon Mar 23, 2009 7:21 pm

HA! I found it.

I had changed typedef double cpFloat; to typedef float cpFloat; in chipmunk.h and I forgot to change it back when i got your latest version.

I guess xCode is picky about function pointers. That was the only place it complained.


Thanks for the help on this. It was driving me nuts.
nino
 
Posts: 9
Joined: Thu Nov 22, 2007 8:21 am

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby slembcke » Tue Mar 24, 2009 11:38 am

Yeah. Looks like someone beat me to it about the cpFloat parameter.

You realize of course that it should be very picky about function pointers. If it wasn't it would allow you to call a function with the wrong types, sizes, or even number of parameters. This is very bad in general. The annoying part is that there are a lot of subtle mistakes that you can make that will work just fine (sometimes only for a specific platform/architecture) but the compiler will complain about.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby nino » Tue Mar 24, 2009 5:16 pm

I guess I would have found out the hard way if I had ever tried to use normal_coef.
Sadly I'm not even sure what that arg is for.
nino
 
Posts: 9
Joined: Thu Nov 22, 2007 8:21 am

Re: can't get rid of warning on cpSpaceAddCollisionPairFunc

Postby slembcke » Wed Mar 25, 2009 11:18 am

You multiply it against the normals in the contact array in case Chipmunk had to swap the order of the shapes to satisfy the order defined in the collision pair definition. It will always be 1.0 or -1.0.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 3 guests

cron