gmp-chudnovsky.c和xcode 4.5

时间:2012-12-24 12:04:11

标签: xcode gmp

当我尝试使用xcode编译并运行gmp-chudnovsky.c文件here时,会出现以下错误:

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添加了头文件和库的路径,并在其他链接器标志下添加了-lgmp标志

1 个答案:

答案 0 :(得分:0)

已解决:见this answer

我认为xcode首先在Debug配置中运行,不执行优化并且不执行内联。这意味着任何inline函数也必须static