[英]How to run C program using pari library with gcc?
#include<stdio.h>
#include<pari/pari.h>
int main(void)
{
GEN i,j,k;
pari_init(500000,2);
i=gun;
j=stoi(3);
k=gadd(i,j);
printf("1+3=%s",GENtostr(k));
return 0;
}
$ I'm a beginner to work on pari library in C. I've installed pari library in cygwin64 with gcc. $我是在C中使用pari库的初学者。我已经使用gcc在cygwin64中安装了pari库。 Any C/C++ program is running.
任何C / C ++程序都在运行。 That is no problem with gcc compiler.
用gcc编译器没问题。 But when I was trying to use pari library for the above sample program.
但是,当我尝试将pari库用于上述示例程序时。 I was getting many errors as follows.
我收到许多错误,如下所示。
Moreover, I use the command $ gcc test-pari.c
to run the program. 此外,我使用命令$
gcc test-pari.c
运行该程序。 Actually I also need to know how to run a program written using pari library in C. Do I need to show some library explicitly during run. 实际上,我还需要知道如何运行使用C语言中的pari库编写的程序。我是否需要在运行期间显式显示某些库。 Any suggestions?
有什么建议么?
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x87): undefined reference to `pari_err'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x87): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pari_err'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x230): undefined reference to `pari_err'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x230): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pari_err'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x253): undefined reference to `pari_init'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x253): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pari_init'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x27f): undefined reference to `gadd'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x27f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `gadd'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x28f): undefined reference to `GENtostr'
/tmp/cc7ELKK4.o:test-pari.c:(.text+0x28f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `GENtostr'
/tmp/cc7ELKK4.o:test-pari.c:(.rdata$.refptr.gen_1[.refptr.gen_1]+0x0): undefined reference to `gen_1'
/tmp/cc7ELKK4.o:test-pari.c:(.rdata$.refptr.gen_0[.refptr.gen_0]+0x0): undefined reference to `gen_0'
/tmp/cc7ELKK4.o:test-pari.c:(.rdata$.refptr.bot[.refptr.bot]+0x0): undefined reference to `bot'
/tmp/cc7ELKK4.o:test-pari.c:(.rdata$.refptr.avma[.refptr.avma]+0x0): undefined reference to `avma'
collect2: error: ld returned 1 exit status
You have to add, at least, -l
option to your command: 您必须至少在命令中添加
-l
选项:
gcc test-pari.c -lpari
Best using: 最佳使用:
gcc test-pari.c -Wall -Wextra -pedantic -lpari -std=c11 -g -o test-pari
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.