标签:
错误如下:
duplicate symbol _iphoneType in:
/Users/midmirror/Library/Developer/Xcode/DerivedData/PRTPrinter-eixyioynyswgruahtmzninftkbmm/Build/Intermediates/PRTPrinter.build/Debug-iphonesimulator/PRTPrinter.build/Objects-normal/x86_64/PRTScreenFit.o
/Users/midmirror/Library/Developer/Xcode/DerivedData/PRTPrinter-eixyioynyswgruahtmzninftkbmm/Build/Intermediates/PRTPrinter.build/Debug-iphonesimulator/PRTPrinter.build/Objects-normal/x86_64/PRTHomeVC.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这个问题比较奇葩的地方在于,用真机是可以编译成功执行
的,但是用模拟器就不能编译通过
。google 了半天也没找到方法。特此记录。
罪魁祸首是用了一个 C 语言的枚举类型定义方式
// 错误
enum iphoneType{
iphone4s = 320*480,
iphone5s = 320*568,
iphone6 = 375*667,
iphone6p = 414*736,
iPad = 1024*768
}iphoneType;
改成Objtctive-C 的枚举类型样式就可以了
// 正确
typedef NS_ENUM(NSInteger, iphoneType) {
iphone4s = 320*480,
iphone5s = 320*568,
iphone6 = 375*667,
iphone6p = 414*736,
iPad = 1024*768
};
其实在C 语言的样式前面直接加上 typedef 也可以,不过不建议这么做,还是乖乖按照 OC 的定义方式来吧。
由于枚举类型导致的1 duplicate symbol for architecture x86_64错误
标签:
原文地址:http://www.cnblogs.com/spiderdzl/p/5891866.html