0

当我尝试使用 xcode 编译和运行此处找到的 gmp-chudnovsky.c 文件时,出现以下错误:

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 库安装正确,因为我有另一个链接到它的 xcode 项目正在正确编译。关于为什么会发生这种情况的任何想法?

忘了说我已经为 GMP 添加了头文件和库的路径,并在 Other Linker Flags 下添加了 -lgmp 标志

4

1 回答 1

0

已解决:请参阅此答案

我认为 xcode 首先在 Debug 配置中运行,其中不执行优化,也不执行内联。这意味着任何inline功能也必须完成static

于 2012-12-27T11:10:46.653 回答