duplicate symbols for architecture x86_64
1 min read

duplicate symbols for architecture x86_64

After upgraded to Xcode 12, I got a long list of warnings for my iOS project:

.......
duplicate symbol 'kNOSAppKey' in:
    /Users/muyexi/Library/Developer/Xcode/DerivedData/sogoke-dioeogsoxykhoidzjsngkyqhivhm/Build/Intermediates.noindex/sogoke.build/Debug-iphonesimulator/sogoke.build/Objects-normal/x86_64/JSONDataModel.o

ld: 1028 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It's because const value was defined in AppConfig.h, and it's imported by JSONDataModel. Moving it into the .m file resolved this issue.