簡體   English   中英

C ++上的鏈接器錯誤

[英]Linker errors on c++

我正在嘗試編譯最短路徑問題的實現(代碼: http : //www.dis.uniroma1.it/challenge9/code/ch9-1.1.tar.gz )。 但是,我得到了錯誤:

le@le-Extensa-4630:~/Desktop/code/ch9-1.1$ make
cd ./gens;    make
make[1]: Entering directory `/home/le/Desktop/code/ch9-1.1/gens'
cd ./grid;    make
make[2]: Entering directory `/home/le/Desktop/code/ch9-1.1/gens/grid'
gcc -O6 -DNDEBUG -DPERMUTE_NODES  -I ../../lib -I ../../lib/ll-core/include -o spgrid.exe spgrid.c -lm         -I../../lib/ ../../lib/ll-core/src/*.c
../../lib/ll-core/src/LConnectivity.c: In function ‘_visitaDSFRicorsiva’:
../../lib/ll-core/src/LConnectivity.c:114:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ui4’ [-Wformat]
../../lib/ll-core/src/LFile_posix.c: In function ‘LFile_GetTempName’:
../../lib/ll-core/src/LFile_posix.c:171:11: warning: ignoring return value of ‘tmpnam’, declared with attribute warn_unused_result [-Wunused-result]
../../lib/ll-core/src/LSystem.c: In function ‘LSystem_GetString’:
../../lib/ll-core/src/LSystem.c:47:10: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
/tmp/ccGnQJPS.o: In function `LArray_ResizeBy':
LArray.c:(.text+0x354): undefined reference to `log'
LArray.c:(.text+0x38e): undefined reference to `pow'
LArray.c:(.text+0x402): undefined reference to `log'
LArray.c:(.text+0x43c): undefined reference to `pow'
/tmp/ccVDr0iU.o: In function `LGraphUtil_RandomUNM':
LGraphUtil.c:(.text+0x988): undefined reference to `sqrt'
LGraphUtil.c:(.text+0x997): undefined reference to `sqrt'
LGraphUtil.c:(.text+0x9a6): undefined reference to `sqrt'
collect2: ld returned 1 exit status
make[2]: *** [spgrid.exe] Error 1
make[2]: Leaving directory `/home/le/Desktop/code/ch9-1.1/gens/grid'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/le/Desktop/code/ch9-1.1/gens'
make: *** [code] Error 2

編輯Makefile以更改-lm位置。 將-lm放在命令行末尾,因為順序取決於gcc / binutils *。

[1]庫可能需要出現在需要它們的對象之后。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM