pascal产生的hpp文件报:E2040 Declaration terminated incorrectly

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值