Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-03

Forward type not resolved

6 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

Hi, I'm trying to create a forward declaration for a class, as I use to do in Delphi, but I'm getting "Forward type not resolved". How can I troubleshoot this?.

Here's the code:

{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils;
type
  TQuote = class; // forward declaration.
  TOnSqueeze = procedure (AQuote: TQuote); of object;
  { TQuote }
  TQuote = class(TCollectionItem)
  private
    FAdjClose: Double;
    FBBand_Diff: Double;
  ...

And, this is the error I'm getting:

quote.pas(11,12) Error: Forward type not resolved "TQuote"

Leonardo M. Ramé
http://leonardorame.blogspot.com

Reply by email

Leonardo M. Ramé
to Leonardo M. Ramé
Leonardo M. Ramé wrote 35 lines
From: Leonardo M. Ramé Subject: [fpc-pascal] Forward type not resolved To: "FPC-Pascal users discussions" Date: Thursday, March 3, 2011, 8:06 PM Hi, I'm trying to create a forward declaration for a class, as I use to do in Delphi, but I'm getting "Forward type not resolved". How can I troubleshoot this?. Here's the code: {$mode objfpc}{$H+} interface uses   Classes, SysUtils; type   TQuote = class; // forward declaration.   TOnSqueeze = procedure (AQuote: TQuote); of object;   { TQuote }   TQuote = class(TCollectionItem)   private     FAdjClose: Double;     FBBand_Diff: Double;   ... And, this is the error I'm getting: quote.pas(11,12) Error: Forward type not resolved "TQuote"

Sorry, the error was here:

   TOnSqueeze = procedure (AQuote: TQuote); of object;

This line should be:

   TOnSqueeze = procedure (AQuote: TQuote) of object;

Leonardo M. Ramé
http://leonardorame.blogspot.com

Reply by email

waldo kitty
to Leonardo M. Ramé
Leonardo M. Ramé wrote 7 lines
Sorry, the error was here: TOnSqueeze = procedure (AQuote: TQuote); of object; This line should be: TOnSqueeze = procedure (AQuote: TQuote) of object;

amazing what a misplaced semi-colon will do, eh? ;)

i would have thought that there would have been an additional error concerning the trailing "of object"... was there? did it give a clue as to the actual error of the misplaced semi-colon?

Reply by email

Jorge Aldo G. de F. Junior
to waldo kitty

im still trying to understand how the compiler understood that sentence in order to generate THAT specific error... (while ignoring a totally out of place 'of' token....)

2011/3/3 waldo kitty :

Show quoted text 19 lines
On 3/3/2011 17:15, Leonardo M. Ramé wrote: > > Sorry, the error was here: > >    TOnSqueeze = procedure (AQuote: TQuote); of object; > > This line should be: > >    TOnSqueeze = procedure (AQuote: TQuote) of object; amazing what a misplaced semi-colon will do, eh? ;) i would have thought that there would have been an additional error concerning the trailing "of object"... was there? did it give a clue as to the actual error of the misplaced semi-colon? _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Florian Klaempfl
to waldo kitty: amazing what a misplaced semi-colon will do, eh? ;) i would have thought that there would…
waldo kitty wrote 14 lines
On 3/3/2011 17:15, Leonardo M. Ramé wrote: > Sorry, the error was here: > > TOnSqueeze = procedure (AQuote: TQuote); of object; > > This line should be: > > TOnSqueeze = procedure (AQuote: TQuote) of object; amazing what a misplaced semi-colon will do, eh? ;) i would have thought that there would have been an additional error concerning the trailing "of object"... was there? did it give a clue as to the actual error of the misplaced semi-colon?

c:\fpc>fpc test.pp
Free Pascal Compiler version 2.4.2 [2010/11/10] for i386 Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Win32 for i386
Compiling test.pp
test.pp(7,12) Error: Forward type not resolved "TQuote" test.pp(9,44) Fatal: Syntax error, "BEGIN" expected but "OF" found

Unfortunatly, Leonardo did not post a complete example but this is what I get by guessing the missing parts.

Reply by email

Marco van de Voort
to Florian Klaempfl

In our previous episode, Florian Klaempfl said:

Show quoted text 14 lines
> i would have thought that there would have been an additional error > concerning the trailing "of object"... was there? did it give a clue as > to the actual error of the misplaced semi-colon? c:\fpc>fpc test.pp Free Pascal Compiler version 2.4.2 [2010/11/10] for i386 Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Win32 for i386 Compiling test.pp test.pp(7,12) Error: Forward type not resolved "TQuote" test.pp(9,44) Fatal: Syntax error, "BEGIN" expected but "OF" found Unfortunatly, Leonardo did not post a complete example but this is what I get by guessing the missing parts.
He did on IRC. Note that the error is different depending on  = class; or =
class(tcollectionitem);

I used 2.5.1 (week old) tho.

unit quote;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils;
type
  TQuote = class;  // (TCollectionItem);  // change thise for a different
error
  TOnSqueeze = procedure (AQuote: TQuote); of object;
  { TQuote }
  TQuote = class(TCollectionItem)
  private
    FAdjClose: Double;
    FBBand_Diff: Double;
    FBBand_Lower: Double;
    FBBand_Middle: Double;
    FBBand_Upper: Double;
    FClose: Double;
    end;
implementation
end.

Reply by email