0
我試圖編譯一個程序,但是當我運行make install
時出現以下錯誤。gcc未定義的引用gd函數
gcc -fPIC -O3 -g -O2 -o treeviewer -L/usr/include -lm -lpng -ljpeg -lgd treeviewer.o tree.o fileio.o tree.o:
In function `drawImage':
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:587: undefined reference to `gdFontMediumBold'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:587: undefined reference to `gdImageString'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:602: undefined reference to `gdImageLine'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:610: undefined reference to `gdImageLine'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:620: undefined reference to `gdImageFilledRectangle'
tree.o: In function `TreeToImage':
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:477: undefined reference to `gdFontMediumBold'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:526: undefined reference to `gdImageCreate'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:527: undefined reference to `gdImageColorAllocate'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:528: undefined reference to `gdImageColorAllocate'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:529: undefined reference to `gdImageColorAllocate'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:530: undefined reference to `gdImageColorAllocate'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:531: undefined reference to `gdImageColorAllocate'
tree.o:/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:532: more undefined references to `gdImageColorAllocate' follow
tree.o: In function `TreeToImage':
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:548: undefined reference to `gdImagePng'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:552: undefined reference to `gdImageDestroy'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:543: undefined reference to `gdImageJpeg'
tree.o: In function `printTreeInfo':
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:642: undefined reference to `gdFontMediumBold'
tree.o: In function `drawImage':
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:627: undefined reference to `gdImageRectangle'
/home/localadmin/codehop-dev/i-codehop/treeviewer/tree.c:624: undefined reference to `gdImageFilledRectangle'
collect2: error: ld returned 1 exit status
make: *** [treeviewer] Error 1
我已經用條命令sudo apt-get -y install libgd2-xpm-dev build-essential
安裝libgd
。文件夾/usr/include
有文件gd.h
。誰能告訴我我錯過了什麼?提前致謝。
我做了列表目錄,以及並重新運行make文件,但還是同樣的結果。 'gcc -fPIC -O3 -g -O2 -o treeviewer -L/usr/include -L/usr/lib/x86_64-linux-gnu -lm -lpng -ljpeg -lgd treeviewer.o tree.o fileio.o' – Brkk