当我尝试在 Fedora 26 Cinnamon 64 位版中运行以下代码时:
#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(int argc, char * argv[]){
mpz_t a, b, c;
mpz_init_set_ui(a,1); /* a = 1 */
mpz_init_set_ui(b,1); /* b = 1 */
mpz_init(c);
for (int i=1; i <= 2 ; ++i){
mpz_add(c,a,b); /* c = a + b */
mpz_mul_ui(a,b,1);
mpz_mul_ui(b,c,1);
}
mpz_out_str(stdout,10,c);
printf ("\n");
mpz_clear(a);
mpz_clear(b);
mpz_clear(c);
return 1;
}
我收到以下错误消息:
fatal error: gmp-x86_64.h: No such file or directory
#include "gmp-x86_64.h"
compilation terminated.
我已经安装了 gmp 库,当whereis gmp
我得到:
gmp: /usr/include/gmp.h /usr/share/info/gmp.info-1.gz /usr/share/info/gmp.info.gz /usr/share/info/gmp.info-2.gz
并寻找 gmp-devel:
当我这样做时,dnf install gmp-devel
我得到:
Last metadata expiration check: 1:48:01 ago on Sun 22 Oct 2017 09:09:57 AM BST.
Package gmp-devel-1:6.1.2-4.fc26.i686 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
但是,当我这样做时,whereis gmp-devel
我只会得到:
gmp-devel:
知道为什么我的系统无法识别 GMP 库吗?