[wplug] libraries

Brian S. Woolstrum woolstrum at cmu.edu
Tue Mar 11 21:33:41 EST 2003


On Tue, 11 Mar 2003, Chris wrote:

>
>
> I am trying to write a little c program and I think that it's getting
> confused with linking the libraries.
>
> It is using the gd, libpng, and zlib libraries.  I had older version on my
> system (RH 7.2) so I download the source for the newer versions and did the
> whole ./configure make make install.  Now what I am guessing is that the new
> installation put the libraries in a different location from where the
> originals are.  How can I tell.  I included the correct header "gd.h".
>
> When I try to compile it, I get the following errors:
>
> test.o: In function `main':
> test.o(.text+0xe): undefined reference to `gdImageCreate'
> test.o(.text+0x24): undefined reference to `gdImageColorAllocate'
> test.o(.text+0x43): undefined reference to `gdImageColorAllocate'
> test.o(.text+0x61): undefined reference to `gdImageLine'
> test.o(.text+0x8c): undefined reference to `gdImagePng'
> test.o(.text+0xa8): undefined reference to `gdImageDestroy'
> collect2: ld returned 1 exit status
>
> It's been a while since I used C so I am very rusty.
>
> Thanks,
> Chris
>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>

I'm not familiar with the gd library. Its also hard to tell
for sure since you didn't put in a copy of the command line
you compiled with, but I would guess that you are
forgetting to tell the linker to link with the library.
Including the header is usually only half of what it takes,
try "gcc -lgd myprog.c -o myprog"




More information about the wplug mailing list