使用gmp时定位库时出错

时间:2016-03-18 10:46:24

标签: c++ clang gmp

所以我一直在编写一个c ++程序,在它里面它处理的内核对于内置的long long来说太大了。没问题,我只使用一个bignum库。所以我得到GMP,说出这三个魔术命令" ./ configure,make,make install"并开始使用它。我使用c ++程序文档中指定的#include "gmpxx.h"。编译它,GPP在gmpxx.h中发现一个错误,因为很明显gmp.h不能使用角度定位,而且应该在gmpxx.h的include语句中使用引号。然而,在将角度更改为引号后,我很惊讶地发现出现了问题,我认为这样做会使得'。它说:

Undefined symbols for architecture x86_64:
  "___gmpz_clear", referenced from:
      __gmp_expr<__mpz_struct [1], __mpz_struct [1]>::~__gmp_expr() in primality-3fd487.o
  "___gmpz_cmp_si", referenced from:
      __gmp_binary_equal::eval(__mpz_struct const*, long) in primality-3fd487.o
  "___gmpz_init", referenced from:
      __gmp_expr<__mpz_struct [1], __mpz_struct [1]>::__gmp_expr() in primality-3fd487.o
  "___gmpz_set_d", referenced from:
          __gmp_expr<__mpz_struct [1], __mpz_struct [1]>::assign_d(double) in   primality-3fd487.o
      "___gmpz_tdiv_r_ui", referenced from:
          __gmp_binary_modulus::eval(__mpz_struct*, __mpz_struct const*, long) in     primality-3fd487.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

有谁知道如何阻止这些错误发生?

0 个答案:

没有答案