自定义功能时的线程断点错误



我正在尝试在Xcode 5上编译此简单程序,并且我在下面的错误行处收到"线程1:brakepoint 1.1"消息。有人知道我如何解决吗?

这是我的代码:

#import <Foundation/Foundation.h>
int totalSavings(int listTotal);
int main(int argc, const char * argv[])
{
    @autoreleasepool {
        int itemEntry, itemEntry1, itemEntry2,
        listTotal, calcSavings;
        itemEntry = 320;
        itemEntry1 = 218;
        itemEntry2 = 59;
        listTotal = itemEntry + itemEntry1 + itemEntry2;
        calcSavings = totalSavings(listTotal);          \error line
        NSLog(@"Total Planned Spending: %d n Amount Saved: %d", listTotal,
        calcSavings);             
        }
    return 0;
}
int totalSavings(int listTotal)
{
    int savingsTotal;
    savingsTotal = 700 - listTotal;
    return savingsTotal;
}

包括呼叫中的int类型的语法不正确。

错误的行:

calcSavings = totalSavings(int listTotal);

固定线:

calcSavings = totalSavings(listTotal);

错误消息是:

Untitled.m:16:36: error: expected expression  
        calcSavings = totalSavings(int listTotal);          // error line  
                                   ^  

注意"^"在int下,这清楚地表明了错误在哪里。

最新更新