Advertising (This ad goes away for registered users. You can Login or Register)

Having problems to compile with zlib

Discuss about your favorite (gaming...or not) devices here. The most popular ones will end up getting their own categories
Programming discussions for your favorite Device
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Locked
Sirius
Posts: 103
Joined: Sat Dec 18, 2010 3:31 pm

Having problems to compile with zlib

Post by Sirius » Wed Apr 27, 2011 11:47 pm

I'm using Ubuntu and eclipse, i'm stuying the routins to compress and decompress with zlib but I cant compile an example, I installed zlib by this way

wget http://www.zlib.net/zlib-1.2.5.tar.gz
tar -xvzf zlib-1.2.5.tar.gz
zlib-1.2.5
sudo ./configure --prefix=/usr/local/zlib
sudo make
sudo make install

I saw this googling how to install zlib.

I dont know how to link it to my proyect, I tried adding -lzlib.h and the path of the headers but it didnt work, the compiler shows me that cant find zlib.h, so I think that I installed zlib in a wrong directory but Im not sure

I am a noob with this kind of stuffs, I hope that someone can helpme :oops:
Advertising

Salmon
Posts: 68
Joined: Fri Jan 07, 2011 12:08 pm

Re: Having problems to compile with zlib

Post by Salmon » Thu Apr 28, 2011 12:21 am

Since you are using Ubuntu you should probably install zlib using the package manager. Use the command

Code: Select all

sudo apt-get install zlib1g-dev
or search for it in the Software Center.

To link the zlib library to your executable use the following flag with gcc

Code: Select all

-lz

Make sure to include zlib.h in your source code.

Code: Select all

#include <zlib.h>
Advertising

Sirius
Posts: 103
Joined: Sat Dec 18, 2010 3:31 pm

Re: Having problems to compile with zlib

Post by Sirius » Thu Apr 28, 2011 1:04 am

Salmon wrote:Since you are using Ubuntu you should probably install zlib using the package manager. Use the command

Code: Select all

sudo apt-get install zlib1g-dev
or search for it in the Software Center.

To link the zlib library to your executable use the following flag with gcc

Code: Select all

-lz

Make sure to include zlib.h in your source code.

Code: Select all

#include <zlib.h>
Yes, thank you, the problem was the instalation and the flag as you said :P

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Having problems to compile with zlib

Post by m0skit0 » Thu Apr 28, 2011 8:50 am

Sirius wrote:Yes, thank you, the problem was the instalation and the flag as you said :P
This is standard for C. You really should take a good book about C and read about libraries and static linking.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

Locked

Return to “Programming and Security”