programming/C++

gcc -lz옵션

applicationlayer 2010. 5. 6. 21:08
poc를 컴파일하는데 에러가 발생했다

#gcc poc.c -o poc
/tmp/ccKjCDpt.o(.text+0x214): In function `zflush':
: undefined reference to `deflate'
/tmp/ccKjCDpt.o(.text+0x3c7): In function `zgetch':
: undefined reference to `inflate'
/tmp/ccKjCDpt.o(.text+0x4e3): In function `do_compression':
: undefined reference to `deflateInit_'
/tmp/ccKjCDpt.o(.text+0x4fa): In function `do_compression':
: undefined reference to `inflateInit_'
collect2: ld returned 1 exit status

compress관련 라이브러리인 libzip을 링크시켜야 된단다.

아래와 같은 옵션을 사용하여 컴파일이 가능하다.

#gcc poc.c -o poc -lz