In my Xcode project I made a standalone header file with the following C utility function:
#ifndef FOO
#define FOO
CGFloat DistanceBetweenTwoPoints(CGPoint p1, CGPoint p2)
{
CGFloat dx = p2.x - p1.x;
CGFloat dy = p2.y - p1.y;
return sqrt(dx*dx + dy*dy);
};
#endif
Even with the preprocessor directives, if I try to import or include that header file in multiple locations, I receive the following error complaining about duplicate symbols:
linker command failed with exit code 1
Is there a different way I can achieve this effect? This question is out of curiosity more than anything else.
Thanks