EhLib包中的一个hpp文件DBGridEh.hpp中的一行代码:
__property bool Eof = {read=GetEof, nodefault};
报如下错误:
[bcc32 Error] DBGridEh.hpp(3110): E2040 Declaration terminated incorrectly
一般情况下这种错误,是由于从pascal转换到c++时变量名产生的问题,因为pascal是大小写不敏感的,而C++是大小写敏感的;把EOF改成Eof(或者EoF也可以)可以解决这个问题;这种问题基本上是由于系统中某个地方已经定义了EOF(预定义宏或者常量),此时编译器就会报这种错误。参考:http://www.delphigroups.info/3/12/119591.html,
would be that there exists somewhere a precompiler macro named EOF()
that is interfering with the compile. If you can change the Pascal
code, try changing "EOF" to "Eof" (and "BOF" to "Bof"). In C++, you
should not have identifiers that are all-caps anyway, as that is
commonly reserved for macros and constants.
Pascal->C++ translation is a literal translation. Case is preserved.
Not everything that works in Pascal will work as-is in C++. It is the
Pascal code's responsibility to do things that can also work in C++
when translated, and this is one of those times when it is not. There
is nothing the compiler can do about that, because it is valid Pascal
code and the .hpp is valid C++ code. It is just not the correct code
from C++'s perspective because it was not set up on the Pascal side to
be so.http://www.delphigroups.info/3/12/119591.html