我在我的Xcode了重复的错误,而建设和运行重复的符号错误的xcode iphone
我有两个文件file1.m和file2.m都使用相同的变量和函数名
file1.h
#import <UIKit/UIKit.h>
@interface file1 : UIViewController {
IBOutlet UILabel *result;
}
-(IBAction)home;
@end
file1.m
#include<file1.h>
@implementation file1
int count = 0;
int arr[2][2];
file2.h
#import <UIKit/UIKit.h>
@interface file2 : UIViewController {
IBOutlet UILabel *result;
}
-(IBAction)home;
@end
file2.m
#include<file2.h>
@implementation file2
int count = 0;
int arr[2][2];
当生成并运行它给我的错误重复的符号 “伯爵” 在file1.o和file2。 如果我改变他们的名字为count1和count2我不会得到任何错误。
在file1.m和file2.m文件中,我正在尝试创建全局变量。
有没有什么办法让我可以用变量相同的名称和功能这两个文件
你可以发布.h吗? – kappa 2012-03-19 23:08:27
你在这里定义全局变量吗?如果是这样,你打算这么做吗?请提供更多的代码。 – 2012-03-19 23:17:12
我发布了一个新的代码。 @HermannKlecker是的,我想要定义全局变量 – big 2012-03-19 23:24:39