Quiero escribir una función en línea, pero aparece un error. ¿Cómo puedo arreglarlo?Error "símbolos indefinidos" de la función en línea
Información de error:
Undefined symbols for architecture i386:
"_XYInRect", referenced from:
-[BeginAnimation ccTouchesEnded:withEvent:] in BeginAnimation.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Código:
CGPoint location = CGPointMake(60, 350);
if (XYInRect(location, 53, 338, 263, 369)) {
}
inline BOOL XYInRect(CGPoint location, float MixX, float MixY, float MaxX ,float MaxY){
if (location.x >MixX && location.y >MixY && location.x <MaxX && location.y <MaxY) {
return YES;
} else {
return NO;
}
}
una respuesta, pero no puedes usar CGRectContainsPoint en vez de rodar su propio? – jrturton
La compilación con el modificador de optimización -O2 funcionó para mí, como se sugiere en http://StackOverflow.com/questions/18939482/clang-linker-fails-if-at-least-o2-wasnt-used y otra pregunta que no puedo más tiempo encontrar. – devon