0

the following code is giving me an unused function in the lines that I have bolded. Can any explain to me why it's giving this error? When I'm attempting to build the app it crashes so I'm assuming it's because of these 2 lines of code as there are no other errors. I'm new to this so sorry if it's a basic question!

    static inline CGVector TCVectorMultiply(CGVector vector, CGFloat m);

    **static inline CGVector TCVectorMinus(CGPoint p1, CGPoint p2)**
    {
        return CGVectorMake(
                    p1.x - p2.x,
                    p1.y - p2.y
                    );
    }

    static inline CGFloat TCVectorLength(CGVector vector)
    { 
    return sqrtf(vector.dx * vector.dx + vector.dy * vector.dy);
    }

     **static inline CGVector TCVectorUnit(CGVector vector)**
    { 
    CGFloat invLen = 1.0 / TCVectorLength(vector);
    return TCVectorMultiply(vector, invLen);
    }

     ****static inline CGVector TCVectorMultiply(CGVector vector, CGFloat m)****
    {
     return CGVectorMake(
                    vector.dx * m,
                    vector.dy * m
                    );
     }

Here is the build output message :)

    2014-07-17 09:41:27.785 Comet Crash[21089:607] Cannot find executable for CFBundle 0x99046c0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)

2014-07-17 09:41:27.869 Comet Crash[21089:607] Unknown class ViewController in Interface Builder file.

  • The function is unused. The easiest solutions are use it, or delete it. – jtbandes Jul 17 '14 at 08:55
  • 2
    I would expect unused functions to produce a compiler warning, not an error. Can you add the exact error message? – Cecilia Jul 17 '14 at 08:56
  • @jtbandes you don't say ;) Adam, the problem might very well be somewhere else. Unused functions will never cause your build to fail. The methods bolded are correct and should not cause a crash. Please add the build output to the question so we can see whats causing the crash. – Alexander W Jul 17 '14 at 08:59
  • @Alexander W I've added the output message now :) Thanks for the help guys :) – Adam Bailey Jul 17 '14 at 09:22
  • Yep, the error resides in a totally different place. Your NIB file has a reference to a class named "ViewController" that doesn't exist. The following SO thread will help you with your problem: http://stackoverflow.com/questions/4591911/unknown-class-firstviewcontroller-in-interface-builder-file – Alexander W Jul 17 '14 at 09:26
  • @AlexanderW Fixed & running perfect!!! Thank you so much for your help!! :) I now have a fully completed Game yay!! Really appreciate your time, I know it can be frustrating help idiots like me some times! ;) – Adam Bailey Jul 17 '14 at 09:50
  • @AlexanderW: Wrong, wrong, wrong. If you set up Xcode so that (a) unused functions produce a warning and (b) all warnings are treated as errors, then an unused function will cause your build to break. As intended. – gnasher729 Jul 17 '14 at 09:59
  • @gnasher729 Yes, this is true. BUT, that is not the standard XCode setting. And as per default, nothing of it is mentioned in the question and thus you cannot make such an assumption. The assumption should be based of the conclusion that he is running XCode std settings. – Alexander W Jul 17 '14 at 10:27

0 Answers0