我已閱讀與此錯誤相關的許多帖子,但仍面臨此問題。 我在我的項目中使用MMDrawerController,當我宣佈MMDrawerController在應用程序委託文件中像MMDrawerController *drawerController;
2個體繫結構i386的重複符號,鏈接器命令失敗,退出代碼爲1
則可以正常工作,但是當我宣佈它Constant.h文件並導入Constant.h文件中的appDelegate文件,並嘗試然後它給我以下錯誤
duplicate symbol _drawerController in:
/Users/icecube/Library/Developer/Xcode/DerivedData/VenueFinder-eowuotuoweptcnfmzowyaajchlnv/Build/Intermediates/VenueFinder.build/Debug-iphonesimulator/VenueFinder.build/Objects-normal/i386/NavigationViewController.o
/Users/icecube/Library/Developer/Xcode/DerivedData/VenueFinder-eowuotuoweptcnfmzowyaajchlnv/Build/Intermediates/VenueFinder.build/Debug-iphonesimulator/VenueFinder.build/Objects-normal/i386/ViewController.o
duplicate symbol _drawerController in:
/Users/icecube/Library/Developer/Xcode/DerivedData/VenueFinder-eowuotuoweptcnfmzowyaajchlnv/Build/Intermediates/VenueFinder.build/Debug-iphonesimulator/VenueFinder.build/Objects-normal/i386/NavigationViewController.o
/Users/icecube/Library/Developer/Xcode/DerivedData/VenueFinder-eowuotuoweptcnfmzowyaajchlnv/Build/Intermediates/VenueFinder.build/Debug-iphonesimulator/VenueFinder.build/Objects-normal/i386/AppDelegate.o
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
不知道我在做什麼錯?我已經檢查並沒有導入.m文件而不是.h
如果 MMDrawerController *drawerController;
此聲明位於appDelegate文件中,但它工作正常,但是如果此聲明位於Constant.h文件中並且導入了AppDelegate.m文件中的Constant.h文件那麼它會給出錯誤。在這兩個類像
從xcode中刪除項目派生數據並退出xcode並重新構建。 – jigs
顯示drawerController的聲明。 –
MMDrawerController * drawerController;當我將這個聲明從appDelegate文件移動到Constant.h文件..然後構建失敗這個上述錯誤 – Divyesh