I have a function as follows:
-(int)ladderCalc:(NSArray*)amounts percentages:(NSArray*)percentages amount:(int)amount
{
// Do some stuff
return foo;
}
I have declared like this in the header file:
-(int)ladderCalc:(NSArray*)amounts percentages:(NSArray*)percentages amount:(int)amount;
But I am getting an error "implicit declaration of function is invalid in c99" when I try to use the int value returned elsewhere in the same file. Am I not declaring the function correctly?
UPDATE
I am realizing that I am not declaring this in the standardized way, I changed my declaration to MarkGranoff's recommendation (see the changes above) but I am still getting it as a warning this time.
Here is the context of how I am calling this function:
-(int)fooTotal: (int)amount
{
int totalFee = 0;
// Declare arguments
NSArray *percentages = [[NSArray alloc] initWithObjects:firstValue, secondValue, thirdValue, fourthValue, fifthValue, nil];
NSArray *amounts = [[NSArray alloc] initWithObjects:sixthValue, seventhValue, eigthValue, ninthValue, nil];
totalFee = ladderCalc(amounts,percentages,amount);
return totalFee;
}
So, I am still getting a warning even though this seems to make sense as far as Obj-C style is concerned.
I am pretty sure I am not calling this function correctly, I am getting an unrecognized symbol error when I compile the project.
Undefined symbols for architecture i386:
"_ladderCalc", referenced from:
-[FeeCalcLibrary getMFModelTotal:] in FeeCalcLibrary-A83D2A7637F57664.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)