FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveLinux / FiveDroid (Android) Naming "Feature" with Harbour Compiler?
Posts: 464
Joined: Tue May 16, 2006 07:47 AM

Naming "Feature" with Harbour Compiler?

Posted: Sun Nov 23, 2008 05:55 AM

Hi all

It seems that if I use the same name for the source file of a class as the class itself ( for example CLASS myclass in file myclass.prg ) the harbour compiler gives an error, namely:

Error F0002 Redefinition of procedure or function: 'MYCLASS'
1 error

and the compilation ( to C source ) fails.

Is this correct / normal behaviour? Certainly xHarbour doesn't have any such problem.

Is this why so many classes are prefaced with a "T" ?

Thanks
xProgrammer

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Naming "Feature" with Harbour Compiler?

Posted: Sun Nov 23, 2008 09:19 AM
Doug,

This code is working fine here. Remember to use the flag /n :

myclass.prg
#include "FiveWin.ch"

function Main()

   local o := MyClass():New()

   MsgInfo( o:ClassName() )

return nil

CLASS MyClass

   METHOD New() INLINE Self

ENDCLASS

> Is this why so many classes are prefaced with a "T" ?

Thats a tradition started from Borland code. They used "T" to distinct between a function name and a Class name. "T" was used for "Type".
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion