#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;
}
$ 我在C.上彩庫工作初學者我已經安裝了同等庫與GCC cygwin64。任何C/C++程序正在運行。這對於gcc編譯器來說沒有問題。但是當我嘗試使用上面的示例程序的pari庫時。我收到了很多錯誤,如下所示。如何使用gcc使用pari庫運行C程序?
此外,我使用命令$ gcc test-pari.c
來運行程序。其實我也需要知道如何運行一個使用C中的pari庫編寫的程序。我是否需要在運行時明確地顯示一些庫。有什麼建議麼?
/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
請出示你的編譯和鏈接命令 – GMichael
$ GCC的測試-pari.c >>我使用這個命令進行編譯,但是我不知道如何使用鏈接命令來編譯pari庫?你能幫我麼? –
那麼:「pari_close();」在節目結束時? – Adam