Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Include file
Message
From
04/10/2007 16:18:07
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01258255
Message ID:
01258720
Views:
13
We talked about this outside the UT box, but I'm glad you posted it here as well. Thanks for your help and I do undertand now, though I still wonder about the why of it. If I can declare a variable in MyMain.prg and have it in scope any place below that, why can't the same be done for constants? I would expect that if I put the INCLUDE call in MyMain program, it would know what it is later down the road, rather than having to make the call again, and again...

Thanks again for all your help! That was pretty much a show stopper for me.

>Jay,
>
>After looking over your code, I found the problem is that the header file also needs to be #INCLUDE'd in emps_registry.prg. This is because certain statements in the Registry class definition that is part of that prg reference constants that are defined in the header file. If the header file is not included when you compile emps_registry.prg, the names are not recognized as constants and are therefore treated as variables at runtime.
>
>Header files must be explicitly included in every program, form, and vcx-based class that references any of the constants DEFINEd in them. Just to be clear, #INCLUDE statements are not "called" at runtime; they take effect at compile time and tell the VFP compiler to replace the name of each defined constant with its literal value. If the compiler is not told to include the header file, the names are treated as variables at runtime, which causes an error if a variable by that name does not exist.
>
>-Rick
>
>
>>>>>I have a form that has an INCLUDE file. I added it through the Form menu. It does not seem to be working as the DEFINE values are not available in the INIT of my form during runtime.
>>>>
>>>>UPDATE: I've even tried putting all the files in one directory, but still no luck. If anyone has any interest in looking at this, I've zipped-up the project. Only a couple files and the only thing I'm trying to resolve right now is why the constants defined in the EMPS_Registry.h file are not available in the form's INIT in runtime. Let me know if you have an extra 10 minutes and I'll email the zip file to you. Thanks in advance!
>>>
>>>Jay,
>>>
>>>I don't know if you saw my earlier reply to you in this thread, but if the suggestions there did not help then go ahead and e-mail me your project and I'll take a look at it. Pls e-mail to the address on my UT profile as per the e-mail icon next to my name.
>>>
>>>-Rick
>>
>>Just sent it. Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform