问题
While opening a dfm file by double clicking, I am getting following error:
Class TMyClass not found. Ignore the error and continue? Note: Ignoring the error may cause components to be deleted or property values to be lost.
When I click Cancel, I get following message
Error creating form: Class TMyClass not found.
When I click OK now, pas file is opened only.
In pas file MyClass unit is added (which conatins the TMyClass defination) and its path is also added in my search path (Ctrl clicking on unit name, takes me to the unit file)
Everything is fine as per me. I don't know why I am getting this error and why am I not able to open this dfm file in RAD studio? Please help.
回答1:
To create the component (that you placed on the form) Delphi IDE should know it by name and have its class loaded into memory. That means - it should have that component compiled into binary runtime package and that corresponding design-time package should be loaded into IDE and during the loading it should call RegisterComponent
.
Usually this all is done during the library installation. So if you have that library for Delphi 7 now just install it for Delphi XE4 as well.
If your library does not have installer or that installer does not know XE4, then you have to register those components manually, just like Delphi documentations asks you to do. That is a multi-step process, so you maybe would need to re-do it from starters. However with any luck you would probably be able to reuse the work already done for Delphi 7. At best case you only would have to recompile runtime and designtime packages in XE4 and then install those design-time ones into newer IDE.
- http://www.cryer.co.uk/brian/delphi/error_class_not_found.htm
- How to install a component from .pas file in delphi?
- Delphi XE2: Encounter "Error Reading Form" when opening a project in IDE
- Delphi XE4 "class not found" but compiles fine
- http://docwiki.embarcadero.com/RADStudio/Rio/en/Installing_Component_Packages
- http://delphi.about.com/library/howto/htinstallcomponent.htm
- http://delphi.about.com/od/vclusing/ht/installwin32.htm
来源:https://stackoverflow.com/questions/19923926/error-opening-a-dfm-file-class-xxxx-not-found