Search code examples
iosios6

iOS Math: undefined symbols fr architecture arm7


I'm getting the following error when trying to use C's math.h library:

#import <Foundation/Foundation.h>
#import <math.h>

@interface Filter : NSObject {
    float cutoff;
    float resonance;
    float sampleRate;
    float *f;
    float freq;
    float damp;
}

- (float)filter:(float)input;

@end

Can you tell me how I can solve this error? It seems that the min() function cannot be compiled to armv7 architectures.

Undefined symbols for architecture armv7:
  "_min", referenced from:
      -[Filter init] in Filter.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

  • On iOS I had to use fmin() instead of min() as alex purposed. Further, i didn't even need to import math.h as Anoop said.