2012-12-24 58 views
0

當我嘗試編譯和運行GMP-chudnovsky.c文件中找到here與Xcode中出現以下錯誤:GMP-chudnovsky.c和Xcode的4.5

Undefined symbols for architecture x86_64: 
    "_fac_clear", referenced from: 
     _main in main.o 
    "_fac_compact", referenced from: 
     _fac_remove_gcd in main.o 
    "_fac_init", referenced from: 
     _main in main.o 
    "_fac_mul", referenced from: 
     _bs in main.o 
    "_fac_mul_bp", referenced from: 
     _bs in main.o 
    "_fac_resize", referenced from: 
     _fac_remove_gcd in main.o 
    "_fac_set_bp", referenced from: 
     _bs in main.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我知道gmp library是否正確安裝,因爲我有另一個xcode項目鏈接到它正在編譯正確。任何想法爲什麼發生這種情況?

忘了說我已經加入路徑頭文件和庫GMP以及在其它鏈接器標記

回答

0

解決添加-lgmp標誌:看this answer

我認爲xcode首先在Debug配置中運行,其中沒有執行優化,也沒有執行內聯操作。這意味着任何inline功能也必須製作成static