nopnop2002 / Raspberry-ili9325

Parallel TFT Shield Library for wiringPi
64 stars 14 forks source link

"Undefined reference" Errors when compiling draw.c and demo.c #34

Closed ciobania closed 2 years ago

ciobania commented 2 years ago

Hello,

I have successfully run the draw and demo binaries, with ILI9341. At least that's what it says my driver is. When I try to compile/build the draw, and demo binaries using:

cc -o demo demo.c fontx.c tft_lib.c driver/.c -lwiringPi -lm -lpthread -DILI9341 -DP16BIT cc -o draw draw.c fontx.c tft_lib.c driver/.c -lwiringPi -lm -lpthread -DILI9341 -DP16BIT

I get following errors:

/usr/bin/ld: /tmp/ccJhYeNu.o: in function JPEGTest': demo.c:(.text+0x1990): undefined reference todecode_image' /usr/bin/ld: demo.c:(.text+0x1b74): undefined reference to release_image' /usr/bin/ld: /tmp/ccJhYeNu.o: in functionPNGTest': demo.c:(.text+0x1cac): undefined reference to pngle_new' /usr/bin/ld: demo.c:(.text+0x1cbc): undefined reference topngle_set_init_callback' /usr/bin/ld: demo.c:(.text+0x1cc8): undefined reference to pngle_set_draw_callback' /usr/bin/ld: demo.c:(.text+0x1cd4): undefined reference topngle_set_done_callback' /usr/bin/ld: demo.c:(.text+0x1cec): undefined reference to pngle_set_display_gamma' /usr/bin/ld: demo.c:(.text+0x1d6c): undefined reference topngle_feed' /usr/bin/ld: demo.c:(.text+0x1d84): undefined reference to pngle_error' /usr/bin/ld: demo.c:(.text+0x2050): undefined reference topngle_destroy' /usr/bin/ld: demo.c:(.text+0x20a4): undefined reference to png_init' /usr/bin/ld: demo.c:(.text+0x20a8): undefined reference topng_draw' /usr/bin/ld: demo.c:(.text+0x20ac): undefined reference to `png_finish' collect2: error: ld returned 1 exit status

Am I missing something, is it still needed if the binaries provided in the repo are working already?

thank you

nopnop2002 commented 2 years ago

There is No $(LIBS).

LIBS = $(DRIVER_LIB) $(JPEG_LIB) $(PNG_LIB)

cc -o demo demo.c fontx.c tft_lib.c $(LIBS) -lwiringPi -lm -lpthread -D$@

https://github.com/nopnop2002/Raspberry-ili9325/blob/master/Makefile#L58

ciobania commented 2 years ago

I don't have driver.a, jpeg.a, etc. I am not tech savt with C, so will have to dig deeper to understand where those come from, or what I need to copy, or provide for those libraries to be there.

Thanks

nopnop2002 commented 2 years ago
$ cd Raspberry-ili9325

$ ls *.a
driver.a  jpeg.a  png.a

for 8Bits
$ cc -o demo demo.c fontx.c tft_lib.c driver.a jpeg.a png.a -lwiringPi -lm -lpthread -DILI9341

for 16Bits
$ cc -o demo demo.c fontx.c tft_lib.c driver.a jpeg.a png.a -lwiringPi -lm -lpthread -DILI9341 -DP16BIT
ElectroBoyCodes commented 2 years ago

@ciobania If you still have problems, i recommend to do a "git clone".

ciobania commented 2 years ago

Hey,

I have managed to use my screen eventually, after I switched to dtoverlays to drive my screen.

Thank you for reply.

ElectroBoyCodes commented 2 years ago

ohk