Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Errors because of DEFINE...ENDDEFINE
Message
 
To
15/08/2007 16:59:21
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01248370
Message ID:
01248378
Views:
27
This message has been marked as a message which has helped to the initial question of the thread.
Jay,

From the Help:

"You cannot follow procedures in a .prg file with normal executable program code. Only class definitions, other procedures, and user-defined functions can follow the first DEFINE CLASS, PROCEDURE or FUNCTION statement in the file. For more information, see User-Defined Procedures and Functions."

Also

"If you include procedures and functions with other code, they must exist at the end of the .prg file following all other normal code. You cannot include normal executable program code following procedures and functions in a .prg file. Only other user-defined procedures, functions, and class definitions can follow the first PROCEDURE or FUNCTION statement in the file."



>Is there some sort of rule of where to define a class in the MAIN program of a project? Seems that if I use DEFINE...ENDDEFINE, everything after that has errors because it thinks it should be in a function when I try to build the EXE. Thanks!
>
>UPDATE: I found this, but I don't know why it would be problem:
>
>
>Statement is not in a procedure (Error 1931)
>Statements are not allowed after the ENDPROC clause. For more information, see DEFINE CLASS.
>
>
>I put this in my MAIN prg just to test defining a class:
>
>

>DEFINE CLASS EMPS_Out_Class AS SESSION OLEPUBLIC
>
> FUNCTION Multiply(tnOne AS INTEGER, tnTwo AS INTEGER) AS INTEGER
> LOCAL lnResult
> ENDFUNC
>
>ENDDEFINE
>

>
>And all lines after it get reported as errors during the build. Why is having an ENDFUNC bad?
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform