记一次duplicate symbol报错
duplicate symbol '_SECRET_KEY' in:
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/AAAAAAAAAA.o
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/BBBBBBBBBBBB.o
duplicate symbol '_API_KEY' in:
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/AAAAAAAAAA.o
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/BBBBBBBBBBBB.o
duplicate symbol '_APP_ID' in:
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/AAAAAAAAAA.o
/Users/holly/Library/Developer/Xcode/DerivedData/2mCar-brcjzggsacqehegbdekptqyafvgt/Build/Intermediates.noindex/2mCar.build/Debug-iphoneos/2mCar.build/Objects-normal/arm64/BBBBBBBBBBBB.o
ld: 3 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我把主页BBBBBBBBBBBB.h改为AAAAAAAAAA.h,复制一份代码到AAAAAAAAAA.h,报错。
最后发现问题,两个类都定义了SECRET_KEY,APP_ID,API_KEY静态变量,导致重复。