Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Include files and constants?
Message
From
25/07/1997 00:49:24
 
 
To
25/07/1997 00:00:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00041459
Message ID:
00041594
Views:
38
You can't include a .h file in the main program and expect to be "seen" in forms because:

#define and #include are compiler directives. That means the constant defined by #define is replaced with its value in your code at compile time.
Example:
#define PI 3.14159
This will replace all occurences of the "PI" string with "3.14159" in your program and will compile it. So, a command like:
lnCircleArea = PI * PI * lnRadius
will be first transformed to:
lnCircleArea = 3.14159 * 3.14159 * lnRadius
and AFTER that will be compiled.

Since the forms/classes are compiled when they are saved, the #include compiler directive is not effective if is issued only at the main program level.

The key in understanding this is that #include and #define are compiler directives and NOT VFP commands. So, their effect is at compile time, not at runtime.

Sorry about other empty reply to this message.

HTH,
Vlad


>No, it's not a joke... I was wondered when I hit the same problem... All
>what I want is include this file in main.prg and use then defined constants
>in whole projects,but no luck ;(, I'm ended up with this ugly solution ;(
>
>Have a happy day
>Vladimir Shevchenko
>
>> Uh, that's a joke, right? I'm sure that I'm not required to have 50
>include
>> statements in each and every form I use this with.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform