Recently I need to use zlib in programming on Ubuntu and here I have a problem.
I wrote a small program to test zlib functions and I built it in Eclipse.
I found it can be compiled but there were some linking errors like this:
main.cpp:27: undefined reference to `compress'
main.cpp:38: undefined reference to `uncompress'
What should I do with this? If this is because there is no library file?
Can anyone give some help? Thanks a lot!
Plus, here are my building info:
11:59:08 **** Build of configuration Debug for project test_zlib ****
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp
Building target: test_zlib
Invoking: GCC C++ Linker
g++ -o "test_zlib" ./main.o
./main.o: In function `main':
/home/hyq/workspace/test_zlib/Debug/../main.cpp:27: undefined reference to `compress'
/home/hyq/workspace/test_zlib/Debug/../main.cpp:38: undefined reference to `uncompress'
collect2: ld return 1
make: *** [test_zlib] error 1
11:59:10 Build Finished (took 1s.715ms) Show your linker command.
以上就是About linking error in zlib on ubuntu的详细内容，更多请关注web前端其它相关文章！