cappelnord/waveformgen

undefined reference to `gdImageSetPixel'

Opened this issue · 3 comments

While I can compile on Mac, when I try to compile on the latest Ubuntu, I get:

# make
gcc  -Wall -O3 -std=c99 -o waveformgen -lm -lsndfile -lgd -lpng waveformgen.c main.c
/tmp/ccOF3z2H.o: In function `drawNumber':
waveformgen.c:(.text+0x13a): undefined reference to `gdImageSetPixel'
/tmp/ccOF3z2H.o: In function `drawTimeline':
waveformgen.c:(.text+0x194): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0x1ad): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0x1c7): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0x200): undefined reference to `gdImageFilledRectangle'
waveformgen.c:(.text+0x2ea): undefined reference to `gdImageSetPixel'
waveformgen.c:(.text+0x356): undefined reference to `gdImageLine'
waveformgen.c:(.text+0x4e3): undefined reference to `gdImageSetPixel'
waveformgen.c:(.text+0x542): undefined reference to `gdImageLine'
waveformgen.c:(.text+0x59c): undefined reference to `gdImageLine'
waveformgen.c:(.text+0xa2c): undefined reference to `gdImageSetPixel'
waveformgen.c:(.text+0xa8c): undefined reference to `gdImageLine'
/tmp/ccOF3z2H.o: In function `wfg_generateImage':
waveformgen.c:(.text+0xb37): undefined reference to `sf_open'
waveformgen.c:(.text+0xbe3): undefined reference to `gdImageCreate'
waveformgen.c:(.text+0xc2f): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0xc4e): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0xc66): undefined reference to `gdImageColorAllocate'
waveformgen.c:(.text+0xcce): undefined reference to `sf_read_float'
waveformgen.c:(.text+0xdf1): undefined reference to `round'
waveformgen.c:(.text+0xe1a): undefined reference to `round'
waveformgen.c:(.text+0xe50): undefined reference to `gdImageLine'
waveformgen.c:(.text+0xe8a): undefined reference to `gdImageLine'
waveformgen.c:(.text+0xed6): undefined reference to `sf_close'
waveformgen.c:(.text+0xf3e): undefined reference to `gdImageDestroy'
waveformgen.c:(.text+0xf49): undefined reference to `gdImagePng'
waveformgen.c:(.text+0xf59): undefined reference to `gdImageDestroy'
waveformgen.c:(.text+0xf86): undefined reference to `sqrt'
waveformgen.c:(.text+0xfbd): undefined reference to `sf_close'
waveformgen.c:(.text+0xfd2): undefined reference to `gdImageDestroy'
waveformgen.c:(.text+0xfe0): undefined reference to `gdImageColorTransparent'
waveformgen.c:(.text+0x100a): undefined reference to `sf_close'
waveformgen.c:(.text+0x1029): undefined reference to `sf_close'
/tmp/ccOF3z2H.o: In function `drawNumberString':
waveformgen.c:(.text+0x117d): undefined reference to `gdImageSetPixel'
collect2: error: ld returned 1 exit status
make: *** [waveformgen] Error 1

I have the package libgd2-xpm-dev 2.0.36rc1dfsg-6.1ubuntu1 installed.

Any ideas?

Mh, this seems odd, as even sort gives an undefined reference error.

Never compiled it on Linux, might try it later in a VM to see if I get the same error.

Hi,

I set up a fresh 13.04 Ubuntu in a VM, installed following:

build-essential cmake git libsndfile-dev libgd2-xpm-dev

cloned repo

cd waveformgen
mkdir build
cd build
cmake ..
make

and initially had a problem not linking to libm, which I fixed the cmake file in the last commit. Now it compiles and installs without problems. I couldn't reproduce your error messages and don't know much about Linux, so can't really help you.

Did you have any luck?

Fantastic, It compiles just fine with the latest master! - thank you :D