How to fix undefined references to inflate/deflate functions?

前端 未结 1 1663
旧巷少年郎
旧巷少年郎 2021-01-19 06:51

I am trying to compile existing code provided in examples by zlib, but it is giving me error at the first place itself:

nikhil@nikhil-Vostro-350         


        
相关标签:
1条回答
  • 2021-01-19 07:38

    You're getting a linker error because you haven't told the compiler to link the library that contains the functions that you've used. The usual way of compiling a simple program that uses zlib on Ubuntu would be:

    gcc -o foo foo.c -lz
    
    0 讨论(0)
提交回复
热议问题