[All]
E2015 Ambiguity between 'PLongint' and 'System::PLongint' in BDE.HPP
Abstract: E2015 Ambiguity between 'PLongint' and 'System::PLongint' in BDE.HPP
E2015 Ambiguity between 'PLongint' and 'System::PLongint' in BDE.HPP
Product Name:��C++Builder�
Product Version:��6
Product Component:��VCL�
Platform/OS Version:� All
Description:
My project worked fine in C++Builder 5, but when compiling it in C++Builder 6, I get errors like the following:
--------------------
[C++ Error] BDE.hpp(4159): E2015 Ambiguity between 'PLongint' and 'System::PLongint'
--------------------
--------------------
[C++ Error] BDE.hpp(4222): E2015 Ambiguity between 'PLongint' and 'System::PLongint'
--------------------
These errors refer to functions called DbiBatchMove() and DbiGetCallBack() in BDE.HPP, which I do not explicitly call.
How can I solve this problem?
Answer/Solution:
This problem seems related to the header file PSOCK.HPP defining its own PLongint instead of using the definition in the System unit, thereby leading to an ambiguity in which one should be used.
It can usually be worked around by changing the order in which you include certain header files. Here's what to do. Find where you have the #include statements for BDE.HPP, PSOCK.HPP, and VCL.H. Then, change the order so that BDE.HPP is included before PSOCK.HPP, and both are included before VCL.H. An ideal #include order would be:
#include <bde.hpp>
#include <psock.hpp>
#include <vcl.h>
If the above does not work, then another possible (albeit less preferable since it involves modifying a header file) solution would be to modify PSOCK.HPP. In PSOCK.HPP, there is a typedef that re-declares PLongint as an int:
--------------------
typedef int *PLongint;
--------------------
Commenting out that line will lead to use of System::PLongint and therefore also remove the problematic ambiguity and solve the problem.
Author:� Yu-Chen Hsueh