【发布时间】:2015-05-11 14:05:28
【问题描述】:
我不是 C++ 专家,但需要将旧项目更新到 Embarcadero C++ Builder XE7。
此代码无法编译(fpFixed 行):
#include <System.UITypes.hpp>
...
NewText->Font->Pitch = fpFixed;
Pitch 在哪里:
__property System::Uitypes::TFontPitch Pitch = {read=GetPitch, write=SetPitch, default=0};
void __fastcall SetPitch(const System::Uitypes::TFontPitch Value);
和
enum class DECLSPEC_DENUM TFontPitch : unsigned char { fpDefault, fpVariable, fpFixed };
错误:“E2451 未定义符号 'fpFixed'”
另外两次尝试:
NewText->Font->Pitch = TFontPitch.fpFixed;
NewText->Font->Pitch = System::Uitypes::TFontPitch.fpFixed;
两者都出错:E2108 错误使用 typedef 'TFontPitch'
但这 - 奇怪的是 - 编译,没有警告:
System::Uitypes::TFontPitch( fpFixed ); // yes,no assignments here just an unused value
NewText->Font->Pitch = fpFixed;
对此有何解释,我在这里做错了吗?只是通过反复试验得出这个“解决方案”。
【问题讨论】:
标签: properties enums c++builder c++builder-xe7