Microsoft KB Archive/167191

= PRB: "Variable 'X' not found" in a Visual FoxPro Menu =

Article ID: 167191

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q167191



SYMPTOMS
When running a menu that uses a constant defined in a header file, the error message "Variable 'x' not found" is returned if the #include statement is in a program that calls the menu.



CAUSE
The constant must be available at menu generation time.



RESOLUTION
The following steps demonstrate adding a #include statement to the menu setup code:  Open your "Menu.mnx" file in design mode, where "Menu.mnx" is the name of your menu file. Select "General Options" from the View menu. Select the "Setup" check box. Click OK.  Add your #include statement to the setup code area, for example: #INCLUDE "C:\VFP\Foxpro.h"                        Close the Setup Code window.</li> Your variables will be available to the menu after you generate and run your menu file.</li></ol>

The above steps resolve the "Variable 'X' not found" error message described above.

<div class="moreinformation_section">

Steps to Reproduce Behavior

 * 1) Use any constant, such as Color_Dark_Red from the "Foxpro.h" header file, in your menu.
 * 2) Generate your menu.

Even if header is defined correctly in your main program, you will receive "Variable 'Color_Dark_Red' not found" when the menu is generated.

<div class="references_section">