Lazarus

Programming => General => Topic started by: Eko Wahyudin on July 20, 2012, 09:07:14 am

Title: Error: Identifier not found 'class'
Post by: Eko Wahyudin on July 20, 2012, 09:07:14 am
Hi,

I'm trying to rebuild lazarus. 0.9.30.4-0. with fpc 2.6.0. In linux mint 13(Maya).

My build configuration is :
 "LCL Widget Type" = gtk 2
 "Target directory" : /home/eko/.lazarus/bin/
 "Build All"
 "Target OS" = Linux
 "Target CPU" = x86_64
 "Clean All" = True
 "With Packages" = True
 "Options" =

and add -CX options in /etc/fpc.cfg to enable smart link.

while compiling, I got some funny error:
Code: [Select]
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(40,22) Error: Identifier not found "class"
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(40,42) Error: Error in type definition
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(41,30) Error: Identifier not found "class"
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(41,31) Error: Illegal expression
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(41,43) Error: Error in type definition
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(42,25) Error: Identifier not found "class"
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(42,26) Error: Illegal expression
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(42,38) Error: Error in type definition
/usr/lib/lazarus/0.9.30.4/components/tachart/tachartutils.pas(43,25) Error: Identifier not found "class"

the code on TAChartUtils.pp is like this
Code: [Select]
type
  EChartError = class(Exception);
  EChartIntervalError = class(EChartError);
  EListenerError = class(EChartError);
  EDrawDataError = class(EChartError); 

tachartutils.pas(40,22) pointing to 'class'. Why class detected as identifier? not as an reserved word??

"how to solve this?"
and
"why this error only come on 'TAChartUtils.pp' while another file compiled smoothly?"

someone has report same problem in 2009. on http://bugs.freepascal.org/view.php?id=12976. But I still can't find the solution.
Title: Re: Error: Identifier not found 'class'
Post by: marcov on July 20, 2012, 11:20:49 am
This is because you don't compile TAChart via packages, but try to manually insert paths to the source.

This means you don't use the tachcart .lpk package file that contains the proper options to compile the source (like -Sd, -S2 and probably else)

Proper solution:

- remove paths.
- compile and install the tachart package.
- in your application's project add an dependency on package tachart.

This procedure will also make your project more independent of Lazarus version and path.
Title: Re: Error: Identifier not found 'class'
Post by: Leledumbo on July 20, 2012, 12:59:12 pm
Quote
-Fu/usr/lib/lazarus/0.9.30.4/components/*
-Fi/usr/lib/lazarus/0.9.30.4/components/printers/unix
-Fu/usr/lib/lazarus/0.9.30.4/components/printers/unix
Oh, man. This is a bad, bad idea... remove them all, follow what marco suggests.
Title: Re: Error: Identifier not found 'class'
Post by: Eko Wahyudin on July 23, 2012, 03:46:07 am
about this line
Code: [Select]
-Fu/usr/lib/lazarus/0.9.30.4/components/*
-Fi/usr/lib/lazarus/0.9.30.4/components/printers/unix
-Fu/usr/lib/lazarus/0.9.30.4/components/printers/unix

I do not know why  %) when this line not exist, the compiler alway say someunit not found while i'm rebuilding lazarus IDE. for example, I'm installing Indy 10 components, in the path directory already pointing to "../fpc;../lazarus" but the compiler said "IdAboutVCL" used by "IdAbout" not found. so I'm add manually in lazarus building configuration. And it's solved (at least for Indy).

In this case, If i remove those line, another error happen
Code: [Select]
Compiling lazarus.pp
/usr/lib/lazarus/0.9.30.4/ide/lazarus.pp(1,1) Fatal: Can't find unit runtimetypeinfocontrols used by Lazarus
unit "runtimetypeinfocontrols" located at /usr/lib/lazarus/0.9.30.4/components/rtticontrols so I'm add
-Fu/usr/lib/lazarus/0.9.30.4/components/rtticontrols in lazarus build configuration.

I'm rebuild via lazarus IDE -> Tools -> Build Lazarus with Profile: Clean up + build all.
Title: Re: Error: Identifier not found 'class'
Post by: Leledumbo on July 23, 2012, 09:13:17 am
Do NOT add those paths, but add the respective packages as dependencies of the problematic package.
TinyPortal © 2005-2018