how to link GD library

OS Ubuntu 14.04

I am trying to run a basic C program using the GD library. The include line is
#include <gd.h>

I installed the tarball from
https://bitbucket.org/libgd/gd-libgd/downloads

ran
1
2
3
./configure
make
make install


Which after poking around i found the includes to be in /usr/local/include and the libs in /usr/local/lib. Although if /usr/local is systemwide, i am not sure why i would have to link them anyways. I tried it without and i get the same.
So my compile code i made to be:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
metulburr@ubuntu ~  $ gcc -I /usr/local/include -L /usr/local/lib test.c -o test
/tmp/cclERMOG.o: In function `main':
test.c:(.text+0x4c): undefined reference to `gdImageCreateTrueColor'
test.c:(.text+0x6b): undefined reference to `gdImageColorAllocate'
test.c:(.text+0x89): undefined reference to `gdImageColorAllocate'
test.c:(.text+0xa7): undefined reference to `gdImageColorAllocate'
test.c:(.text+0xc5): undefined reference to `gdImageColorAllocate'
test.c:(.text+0xf7): undefined reference to `gdImageFilledRectangle'
test.c:(.text+0x13f): undefined reference to `gdImageFilledRectangle'
test.c:(.text+0x16e): undefined reference to `gdImageFilledRectangle'
test.c:(.text+0x1b9): undefined reference to `gdImageFilledRectangle'
test.c:(.text+0x3f9): undefined reference to `gdImageFilledPolygon'
test.c:(.text+0x592): undefined reference to `gdImagePngEx'
test.c:(.text+0x5aa): undefined reference to `gdImageDestroy'
collect2: error: ld returned 1 exit status
metulburr@ubuntu ~  $  

How come gcc still cannot find GD library?

location:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
metulburr@ubuntu ~  $ ls /usr/local/include | grep gd
gdcache.h
gd_color_map.h
gd_errors.h
gdfontg.h
gdfontl.h
gdfontmb.h
gdfonts.h
gdfontt.h
gdfx.h
gd.h
gd_io.h
gdpp.h
metulburr@ubuntu ~ $ ls /usr/local/lib | grep gd
libgd.a
libgd.la
libgd.so
libgd.so.3
libgd.so.3.0.0
metulburr@ubuntu ~ $ 
Last edited on
nevermind forgot to link the name
-lgd
Topic archived. No new replies allowed.