编译器返回clang错误1没有明显的原因

时间:2016-07-05 23:50:10

标签: ios xcode clang linker-errors duplicate-symbol

我没有看到存在循环定义的位置或两个具有相同名称的文件,有人可以告诉我如何阅读和理解此链接器错误消息吗?

Ld /Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Products/Debug-iphonesimulator/myMilesApp.app/myMilesApp normal x86_64
cd /Users/jurgendictus/Dropbox/proggies/xCode/myMilesApp/myMilesApp
export IPHONEOS_DEPLOYMENT_TARGET=9.3
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -L/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Products/Debug-iphonesimulator -F/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Products/Debug-iphonesimulator -filelist /Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/myMilesApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.3 -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/myMilesApp.swiftmodule -lsqlite3.0 -framework UIKit -Xlinker -dependency_info -Xlinker /Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/myMilesApp_dependency_info.dat -o /Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Products/Debug-iphonesimulator/myMilesApp.app/myMilesApp

duplicate symbol _logMethods in:
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beDbAccess.o
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beGlobalFunctions.o
duplicate symbol _logEndMethods in:
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beDbAccess.o
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beGlobalFunctions.o
duplicate symbol _verbose in:
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beDbAccess.o
/Users/jurgendictus/Library/Developer/Xcode/DerivedData/myMilesApp-fytkctapxamadqdmxvtpdexztqjr/Build/Intermediates/myMilesApp.build/Debug-iphonesimulator/myMilesApp.build/Objects-normal/x86_64/beGlobalFunctions.o
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我想它必须在beGlobalFunctions.h或beDbAccess.h中的某个地方

1 个答案:

答案 0 :(得分:0)

好的,我似乎忽略了错误日志中的变量名logMethods,logEndMethods和verbose。 我将声明移到了实现的.m文件中。

离。

@implementation beDbAccess
{
    BOOL logMethods, logEndMethods, verbose;
}

这解决了编译错误