2015-11-04 92 views
-1

我已閱讀與此錯誤相關的許多帖子,但仍面臨此問題。 我在我的項目中使用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文件那麼它會給出錯誤。在這兩個類像

+0

從xcode中刪除項目派生數據並退出xcode並重新構建。 – jigs

+0

顯示drawerController的聲明。 –

+0

MMDrawerController * drawerController;當我將這個聲明從appDelegate文件移動到Constant.h文件..然後構建失敗這個上述錯誤 – Divyesh

回答

0

相同的變量退出gobally所以本地聲明它,就像

@interface ViewController : UIViewController{ 
    MMDrawerController *drawerController; 
} 

看來你在這兩個類中聲明在實現部分這個變量,我的意思是在.M文件。

@implementation ViewController 
MMDrawerController *drawerController; 
0

通過吊艙安裝MMDrawerController 莢 'MMDrawerController', '〜> 0.5.7'

刪除庫手動導入您的項目。 Xcode爲您的MMDrawerController獲取重複路徑,因此在Build Settings中更好地檢查LINKER搜索路徑

相關問題