2012-08-23 36 views
1

當我運行我的項目時,出現錯誤,此項目包含靜態庫。添加靜態庫時構建項目出錯

Undefined symbols for architecture i386: 
"_OBJC_CLASS_$_Composer", referenced from: 
    objc-class-ref in libImageCollage_Simulator.a(ImageCollageTableViewController.o) 
"_OBJC_CLASS_$_FirstTableViewCell", referenced from: 
    objc-class-ref in libImageCollage_Simulator.a(ImageCollageTableViewController.o) 
"_OBJC_CLASS_$_SecondTableViewCell", referenced from: 
    objc-class-ref in libImageCollage_Simulator.a(ImageCollageTableViewController.o) 
"_OBJC_CLASS_$_ThirdTableViewCell", referenced from: 
    objc-class-ref in libImageCollage_Simulator.a(ImageCollageTableViewController.o) 
ld: symbol(s) not found for architecture i386 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我該怎麼辦?

+0

您是否已將庫添加到用戶搜索路徑中? – CBredlow

回答

0

項目是用靜態庫鏈接,你還沒有加入libImageCollage_Simulator.a庫中的項目,要添加前往構建階段的項目設置,在目標相關點擊+和庫添加到您的項目enter image description here

而且在這裏添加庫搜索路徑 轉到構建階段和雙擊庫搜索路徑,單擊加號並在項目中添加庫的路徑

+0

當我單擊目標依賴項中的+時,我在列表中沒有庫。 – Endore8

+0

那你是如何包含靜態庫的?它會像'libraryname.a' – Sumanth

+0

我將庫和頭文件複製到項目文件夾中並添加它。 Xcode自動添加庫「Link Binary With Libraries」 – Endore8