问题描述
- xcode报错:duplicate symbol
-
写了一段代码 之前测试的时候可以运行 后来不知道加了什么引起报错,报错如下:
duplicate symbol OBJC_IVAR$_WordChooser._theword in:
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/gamemodel.o
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/WordChooser.o
duplicate symbol OBJC_METACLASS$_WordChooser in:
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/gamemodel.o
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/WordChooser.o
duplicate symbol OBJC_CLASS$_WordChooser in:
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/gamemodel.o
/Users/themacairof202/Library/Developer/Xcode/DerivedData/test_file_1-bjtlsetupimkydblqinsnpxunfav/Build/Intermediates/test file 1.build/Debug-iphonesimulator/test file 1.build/Objects-normal/i386/WordChooser.o
ld: 3 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)大约意思是说程序里有重复的文件?求解怎么排查
解决方案
你搜索一下这个关键字 WordChooser ,看看是否存在两个模块
从报错来看, 是 gamemodel 和 WordChooser 中有重复的模块
解决方案二:
直接删掉去文件夹试试,当然,删之前留个备份= =路径不好找,打开终端,输入open 空格 然后粘贴上路径.
解决方案三:
/Users/themacairof202/Library/Developer/Xcode/DerivedData这个删了重新build试下,放心,这个是编译后的临时文件
时间: 2024-12-24 21:54:55