- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 C++ 项目中使用 GNU 多精度 (GMP) 库。当我尝试编译我的代码(使用 g++ project.cpp
)时,我得到以下输出:
Undefined symbols for architecture x86_64:
"___gmpz_clears", referenced from:
_main in project-d867c2.o
"___gmpz_inits", referenced from:
_main in project-d867c2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
从阅读相关问题来看,似乎 32 位和 64 位库之间存在一些冲突。不过我对此了解不多。
How can I resolve this conflict?
最佳答案
解决 32 位和 64 位兼容问题的一般方法是自己编译库的源代码。虽然我对 GMP 一无所知,但许多 C++ 库使用 CMAKE 或 Visual Studio 解决方案进行编译。
在 GMP 的网站上,我在下载部分找到了:
Instead of using a release, you may also get the latest code from the GMP repositories. This will require some more work compared to using a release.
文本“GMP 存储库”上有一个链接,最终位于此处:https://gmplib.org/devel/repo-usage.html
这些似乎是关于自己编译的说明。
在您的情况下,您似乎正在处理一个 64 位项目,而您的 GMP 发行版是 32 位的。如果您不使用额外资源,另一种解决方案是将您的项目简单地切换到 32 位项目。 警告:如果这样做,您可能会破坏代码。分配给超长数组或其他特定于操作系统的函数调用可能依赖于 64 位类型。
关于c++ - 如何解决 GMP 的 32 位和 64 位库之间的冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40836956/
任意精度库 GMP 和 MPFR 使用机器字大小整数的堆分配数组来存储构成高精度数字/尾数的肢体。 应该如何解释这个肢体数组以恢复任意精度整数?换句话说:对于 N 个肢体,每个肢体持有 B 位,我应该
任意精度库 GMP 和 MPFR 使用机器字大小整数的堆分配数组来存储构成高精度数字/尾数的肢体。 应该如何解释这个肢体数组以恢复任意精度整数?换句话说:对于 N 个肢体,每个肢体持有 B 位,我应该
我想安装 R 的 Rmpfr 库,所以我在 R 中输入: install.packages("Rmpfr") 这个包需要安装GMP C库,在Ubuntu中可以在终端输入安装 sudo apt-get
我刚开始使用 GMP,因为我需要检查任何一个功能。 我下载了 gmp-6.0.tar,将其解压,然后在我的代码中使用了 gmp_printf。 现在,当我打开 gmp_printf.c 时,它有一个头
我正在尝试让 GMP 与 Xcode 一起工作。到目前为止,我已经解压缩了主目录中的文件,运行了所有必要的命令来配置、制作和安装 ./configure --prefix=/usr/local --e
GMP库中是否实现了任何对数函数? 最佳答案 没有,GMP中没有这样的功能。 仅在MPFR中。 关于gmp - 有GMP对数函数吗?,我们在Stack Overflow上找到一个类似的问题: http
如何知道 GMP 中声明变量的大小?或者我们如何确定 GMP 中整数的大小? mpz_random(temp,1); 在手册中,该函数将 1limb(=32bits for my comp) 大小分配
我想生成一个 n 字节的随机整数 z,这样 2^(n-1) <= z <= 2^n - 1 每当我运行以下代码时,gmp 会输出完全相同的整数,我做错了什么? // Random int of n b
考虑以下代码 // BOGP.cpp : Defines the entry point for the console application. // #include "stdafx.h" #in
我正在开发一个程序,用于在 C++ 中分解非常大的数字(20 位或更多),并且正在使用 GMP 来处理溢出问题。我的程序对于大约 10 位或更少的数字运行良好,但是当我向它抛出一个 15 位数字时,它
根据 GMP 手册,“整数运算函数假设所有整数对象都已初始化。您可以通过调用函数 mpz_init 来完成此操作。” 例如, int main(){ mpz_t n1, n2, result;
我对模块编码很陌生,我需要在模块中运行一些使用 GMP 库的计算。 所以第一个问题:通常可以在内核中运行 GMP 吗?为了测试,我编写了这个模块: #include #include #inclu
是否可以在独立环境中使用 GMP? 我正在开发一个必须在裸机上运行的程序(为了减少开销并出于安全目的 - 不允许使用外部代码),这迫使我创建一个简约的内核,但是,我还需要使用 GMP任意大的整数。我研
我需要计算三个二维数组。当我尝试使用 GMP 库初始化数组时。我收到以下错误: GNU MP: Cannot allocate memory (size=16) Aborted (core dumpe
这是为数学极客准备的;) 我正在编写一个小型 C 程序,使用 GNU MP 库来计算前 10 个斐波那契数。这是我的尝试: #include "gmp.h" #include #include #
我正在尝试获取 gmp 上的机器精度变量。 为此,我改编了 wikipedia 中的代码,以固定精度计算 gmp 的精度: int main( int argc, char **argv ) {
目前我正在查看 GMP 库的文档,我在理解函数规范中列出的变量的命名约定时遇到了一些困难。 特别是 rop 和 op 的使用让我感到困惑。 这是列出导入和导出函数的页面,由于我对命名约定的混淆,我很难
我正在尝试编写这样的代码 .... mpz_class *x = NULL; mpz_class *lValue = NULL; .... for(int k = 0; k 分配你的数组。尽管您已经为
我正在使用 GMP 包来实现两个函数的乘积,我表示为两个收敛级数的柯西乘积。 更详细地说:我正在寻找一种方法来计算 f(x)=g(x)*h(x)其中 g(x)是指数函数,h(x)是一个特殊的超几何函数
我在 debian/amd64 上,我想使用 NDK-7b 为 android 2.2 交叉编译 GMP。我从 [gmplib](hg clone http://gmplib.org:8000/gmp
我是一名优秀的程序员,十分优秀!