423,851 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,851 IT Pros & Developers. It's quick & easy.

Problem using zlib with Borland's C++ Builder

P: 3
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
Dec 20 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 671
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.  
Dec 21 '07 #2

P: 3
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.
Dec 21 '07 #3

P: 3
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
Dec 21 '07 #4

P: 1
Try put this conditional defines:
ZLIB_DLL;ZLIB_WINAPI;Z_PREFIX

on your BPR file.

Best regards,

wlad.
Oct 8 '18 #5

Post your reply

Sign in to post your reply or Sign up for a free account.