From: Rafal B. <raf...@gm...> - 2012-07-27 10:08:28
|
I've encountered an issue whilst developing my own application based on * libpng* (1.5 version). Long story short, I need to static link this library but I keep getting '*undefined reference`* errors. I tried both extracting *libpng15.a *and adding its content to my library as well as linking with a *gcc* command. My *gcc *command: > *gcc test.c librimg.a libz.a libpng15.a -o test -std=c99 -lglfw -lGL > -lGLU* Errors I get: > *libpng15.a(libpng15_la-png.o): In function `png_reset_crc': > /home/robin/Downloads/libpng-1.5.12/png.c:111: undefined reference to > `crc32' > libpng15.a(libpng15_la-png.o): In function `png_calculate_crc': > /home/robin/Downloads/libpng-1.5.12/png.c:152: undefined reference to > `crc32' > libpng15.a(libpng15_la-png.o): In function `png_reset_zstream': > /home/robin/Downloads/libpng-1.5.12/png.c:757: undefined reference to > `inflateReset' > libpng15.a(libpng15_la-pngread.o): In function `png_create_read_struct_2': > /home/robin/Downloads/libpng-1.5.12/pngread.c:119: undefined reference to > `inflateInit_' > libpng15.a(libpng15_la-pngread.o): In function `png_read_row': > /home/robin/Downloads/libpng-1.5.12/pngread.c:557: undefined reference to > `inflate' > libpng15.a(libpng15_la-pngread.o): In function `png_read_destroy': > /home/robin/Downloads/libpng-1.5.12/pngread.c:1070: undefined reference to > `inflateEnd' > libpng15.a(libpng15_la-pngrutil.o): In function `png_inflate': > /home/robin/Downloads/libpng-1.5.12/pngrutil.c:333: undefined reference to > `inflate' > /home/robin/Downloads/libpng-1.5.12/pngrutil.c:362: undefined reference to > `inflateReset' > libpng15.a(libpng15_la-pngrutil.o): In function `png_read_finish_row': > /home/robin/Downloads/libpng-1.5.12/pngrutil.c:3848: undefined reference > to `inflate' > /home/robin/Downloads/libpng-1.5.12/pngrutil.c:3880: undefined reference > to `inflateReset' > collect2: ld returned 1 exit status* (Note: I've compiled library from source and directory * /home/robin/Downloads/libpng-1.5.12*/ is a place where I extracted the archive.) It's probably worth mentioning that I can link to a shared library without any difficulties: > *gcc test.c librimg.a -o test -std=c99 -lpng15 -lglfw -lGL -lGLU* I would appreciate any help. -- Looking forward to a response, Rafał Bolanowski |