Microsoft KB Archive/115056

{| = PRB: #DEFINE in Setup Code Ignored If Only Line of Code =
 * width="100%"|

ID: Q115056

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6

SYMPTOMS
If a single #DEFINE preprocessor directive is used in the Setup code of a screen, the constant is never defined and the following error message is generated when the constant is referenced:

Variable [" "] not found.

RESOLUTION
To avoid this problem, add a comment somewhere in the Setup code. For an example, see "Workaround" in the "More Information" section below.

MORE INFORMATION
The #DEFINE preprocessor directive is used to create compile-time constants in programs. Using #DEFINE to create constants instead of using memory variables can save on memory consumption, increase performance, and simplify programs.

Steps to Reproduce Behavior
1. Create new screen.

2. In the Setup code, enter the following command:

#DEFINE x 10 3. To test the value of x, add a push button to the screen. In the VALID clause of the push button, enter this command:

WAIT WINDOW STR(x) 4. Save, generate, and run the screen. 5. Click the push button. You will receive the following error message:

Variable 'x' not found Open the screen program (.SPR file). There will not be any generated Setup code, even though the #DEFINE was added above.

Workaround
1. Open the screen (.SCX) file again.

2. Open the Setup code and add a comment somewhere in the Setup code.

3. Generate the screen again.

4. Click the push button. A wait window should appear with "10" as its

prompt. Additional reference words: FoxDos FoxWin 2.50 2.50a 2.50 2.60 KBCategory: kbenv kbprg kbprb KBSubcategory: FxenvMemory
 * }