General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only