0

我有这种方法SplashViewController.m

NSString *letters2 = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

-(NSString *) genRandStringLength: (int) len {
    NSMutableString *randomString = [NSMutableString stringWithCapacity: len];

    for (int i=0; i<len; i++) {
        [randomString appendFormat: @"%C", [letters2 characterAtIndex: arc4random() % [letters2 length]]];
    }

    return randomString;
}

然后我有相同的代码段RegistrationViewController.m

NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

-(NSString *) genRandStringLength: (int) len {
    NSMutableString *randomString = [NSMutableString stringWithCapacity: len];

    for (int i=0; i<len; i++) {
        [randomString appendFormat: @"%C", [letters characterAtIndex: arc4random() % [letters length]]];
    }

    return randomString;
}

我的问题是它给出了这样的错误

       重复符号 _letters2 在:
      路径/对象-正常/armv7/SplashScreen.o   

    /Objects-normal/armv7/RegisterViewController.o

    ld:架构 armv7 的 1 个重复符号
    clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
4

0 回答 0