2016-07-05 156 views
0

我沒有看到有一個循環定義或兩個文件具有相同的名稱,有人可以告訴我如何閱讀和理解此鏈接器錯誤消息?編譯器返回鐺錯誤1沒有明顯的原因

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

回答

0

好地方,似乎我忽略了變量名logMethods,logEndMethods和詳細的錯誤日誌。 我把聲明移到了實現下的.m文件中。

ex。

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

,這解決了編譯錯誤