Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem using zlib with Borland's C++ Builder

Newbie
 
Join Date: Dec 2007
Posts: 3
#1: Dec 20 '07
Hello,

First of all I'm a relatively inexperienced C++ programmer so this may seem a simple question to answer.

I'm trying to use zlib from www.zlib.net to decompress some data. However I run into an error when I try to compile the program :

E2015 Ambiguity between 'Byte' and 'System::Byte'

And the offending code (within zconf.h) is :

Expand|Select|Wrap|Line Numbers
  1. #ifdef SMALL_MEDIUM
  2.    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
  3. #  define Bytef Byte
  4. #else
  5.    typedef Byte Bytef;
  6. #endif
I've simply included the relavant header files from zlib in my own C++ files and attempted to build, however I suspect this is wrong because zlib source code is written in C.

Can anyone tell me what I must do to get the zlib C code to work in Borland's C++ builder 6 ?

Many thanks

Zed

Expert
 
Join Date: Aug 2007
Posts: 674
#2: Dec 21 '07

re: Problem using zlib with Borland's C++ Builder


Wait a minute, did you even compile the library first?

EDIT: And it should say:

Expand|Select|Wrap|Line Numbers
  1. #ifdef SMALL_MEDIUM
  2.    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
  3. #  define Bytef Byte FAR
  4. #else
  5.    typedef Byte  FAR Bytef;
  6. #endif
  7.  
Newbie
 
Join Date: Dec 2007
Posts: 3
#3: Dec 21 '07

re: Problem using zlib with Borland's C++ Builder


Quote:

Originally Posted by oler1s

Wait a minute, did you even compile the library first?

EDIT: And it should say:

Expand|Select|Wrap|Line Numbers
  1. #ifdef SMALL_MEDIUM
  2.    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
  3. #  define Bytef Byte FAR
  4. #else
  5.    typedef Byte  FAR Bytef;
  6. #endif
  7.  

Well I knew I'd done something daft. I'm so used to to just clicking things on menus to build a project. Thanks for your comment.
Newbie
 
Join Date: Dec 2007
Posts: 3
#4: Dec 21 '07

re: Problem using zlib with Borland's C++ Builder


Unfortunately after blundering round in the dark I've no idea how I build the zlib library and then how to include it in my project. Unfortunately not being an expert in this area, the 'instructions' that come with zlib are as clear as mud to me.

Once I've downloaded zlib123.zip what is my next step ? Am I supposed to build a library from the source, and if so can anyone give me some pointers how I go about this. I am using Borland's C++ builder 6.

Sorry if this is a daft question but I cannot make head-nor-tail of all the make files etc. It seems to me that it's aimed at UNIX installations rather than win32 so I cannot simply follow the 'instructions' given with zlib.

Many thanks

Zed
Reply