0

我有以下头文件

typedef enum {
    MONDAY = 1,
    TUESDAY = 2,
    WEDNESDAY = 3,
    THURSDAY = 4,
    FRIDAY = 5,
    SATURDAY = 6,
    SUNDAY = 7,
} WeekDaysEnum;



NSString* dayToString(WeekDaysEnum theDay)
{
    switch (theDay) {        
        case MONDAY:
            return @"Monday";
            break;

        case TUESDAY:
            return @"Tuesday";
            break;

        case WEDNESDAY:
            return @"Wednesday";
            break;

        case THURSDAY:
            return @"Thursday";
            break;

        case FRIDAY:
            return @"Friday";
            break;

        case SATURDAY:
            return @"Saturday";
            break;

        case SUNDAY:
            return @"Sunday";
            break;
    }
}

对于某些函数dayToString会导致以下错误:

linker command failed with exit code 1

如何dayToString在 Objective-C.m文件中调用函数?

4

1 回答 1

1

将函数从头文件移动到单独的源文件或将其声明为inline.

于 2012-08-18T06:34:27.687 回答