Tommi Prami 130 Posted August 11, 2023 (edited) Code that builds in one project fails in other. TResamplerObj = class id: integer; name: string; func: TResamplerFunction; end; if I and public-keyword after class() it'll build TResamplerObj = class public id: integer; name: string; func: TResamplerFunction; end; I've never seen behaviour like this. First of all usually there is strict private/private keyword. But the code should build, because it'll do so in other projects. -Tee- Edited August 11, 2023 by Tommi Prami Typo Share this post Link to post
Tommi Prami 130 Posted August 11, 2023 17 minutes ago, Vandrovnik said: What error message do you get? [dcc32 Error] Img32.pas(605): E2217 Published field 'id' not a class or interface type Maybe there is compiler setting for that... Try to find again..., Share this post Link to post
Tommi Prami 130 Posted August 11, 2023 Emit Runtime type information for Debug build was on. 2 Share this post Link to post
Vandrovnik 214 Posted August 11, 2023 3 hours ago, Tommi Prami said: Emit Runtime type information for Debug build was on. It probably treats that section as published then: The compiler treats a published section like public unless RTTI is enabled with the $M or $TypeInfo compiler directives, or if the class inherits from a class with RTTI enabled. TPersistent in Delphi’s Classes unit enables published RTTI, so all persistent classes (including all components, controls, and forms) have RTTI. The initial, unnamed section is published for classes with RTTI. 1 Share this post Link to post
Remy Lebeau 1394 Posted August 11, 2023 6 hours ago, Tommi Prami said: [dcc32 Error] Img32.pas(605): E2217 Published field 'id' not a class or interface type https://docwiki.embarcadero.com/RADStudio/en/E2217_Published_field_'%s'_not_a_class_or_interface_type_(Delphi) Quote all fields which are not class nor interface types must be removed from the published section of a class. If it is a requirement that the field actually be published, then it can be accomplished by changing the field into a property, 1 Share this post Link to post