Page 1 of 1

BDS App won't compile when I added TMyConnection

Posted: Wed 21 Feb 2007 13:04
by wford23
I am trying to add database functionality to one of my existing applications. When I added the TMyConnection to one of my forms and tried to compile, I get the following errors:
[C++ Error] Zlib.hpp(277): E2189 extern variable cannot be initialized
[C++ Error] Zlib.hpp(277): E2108 Improper use of typedef 'TZStreamRec'
[C++ Error] Zlib.hpp(277): E2451 Undefined symbol 'strm'
[C++ Error] Zlib.hpp(277): E2293 ) expected
[C++ Error] Zlib.hpp(282): E2189 extern variable cannot be initialized
[C++ Error] Zlib.hpp(282): E2108 Improper use of typedef 'TZStreamRec'
[C++ Error] Zlib.hpp(282): E2293 ) expected
[C++ Error] Crxml.hpp(202): E2040 Declaration terminated incorrectly

I had no problem getting the MyDAC components to work in a new application.

I am using BDS version:
Borland® Developer Studio for Microsoft® Windows™ Version 10.0.2166.28377 Update 1 Copyright © 2005 Borland® Software Corporation. All Rights Reserved.

Win2K version:
build 2195, SP4

MyDAC version:
5.0

Any suggestions? I have to get this working to purchase.

Posted: Wed 21 Feb 2007 14:00
by Antaeus
MyDAC for the Delphi 7 IDE and higher uses ZLib files that comes with the IDE.
Possible reason of the problem is that any other third-party component set has installed one more copy of ZLib files. Try to comment (rename) path to these files.

Posted: Wed 21 Feb 2007 14:28
by wford23
I searched my entire drive, there is only one copy of ZLib.

Posted: Wed 21 Feb 2007 15:11
by Antaeus
I could not reproduce the problem. Please send me (evgeniyd*crlab*com) a simple project that is not compilable in your environment.

Posted: Thu 22 Feb 2007 14:52
by wford23
The problem is actually being caused by the use of the ostream function "flush" in the declaration of the deflate and inflate functions defined in ZLib.hpp:

extern PACKAGE int __fastcall inflate(TZStreamRec &strm, int flush);
extern PACKAGE int __fastcall deflate(TZStreamRec &strm, int flush);

I don't understand why 'flush' would refer to the ostream function here, since the entire ZLip.hpp file is enclosed in a namespace block.

The second problem is the use of EOF (defined in stdio.h I think) in the file CRXml.hpp line 202:
__property bool EOF = {read=FEof, nodefault};

This file is also enclosed in a namespace. Can anyone explain what is going on here and how to fix it?

Thanks!

Posted: Thu 22 Feb 2007 15:12
by Antaeus
Sometimes our users report us about similar problems. As a rule the reason of such problems is a third-party component set that installs one more copy of ZLib.
It's hard to determine the reason of the problem you have encountered if we do not have an example.