Felipe Barreiros
Felipe Barreiros

Reputation: 2099

Objective-C iOS Application - Symbol(s) not found

This is my code:

- (double)performOperation:(NSString *)operation {
    if([operation isEqual:@"sqrt"])
        operand = srqt(operand);
    return operand;
}

And this is the error that is preventing my app from running

Undefined symbols:
  "_srqt", referenced from:
      -[CalculatorBrain performOperation:] in CalculatorBrain.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Heeeelp! :D

Upvotes: 0

Views: 356

Answers (4)

pyramation
pyramation

Reputation: 1671

OK, do this

#include <math.h>

Then check your spelling on srqt(), it should be sqrt().

Upvotes: 0

MarkPowell
MarkPowell

Reputation: 16540

It is sqrt not srqt. and seven more characters to prove I'm human...

Upvotes: 0

Seega
Seega

Reputation: 3390

yo wrote operand = srqt(operand); but meant operand = sqrt(operand);

Upvotes: 5

James Sumners
James Sumners

Reputation: 14777

if([operation isEqual:@"sqrt"])
    operand = srqt(operand);

Notice that you have misspelled the sqrt function in the second line. That is, unless you have defined your own srqt function. But according to the linker error, it seems that you have not.

Upvotes: 5

Related Questions