Microsoft KB Archive/102586

= PRB: Unable to Find Proc./Func.  =

Article ID: 102586

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a

-



This article was previously published under Q102586



SYMPTOMS
When you are building an application (.APP) from a project that makes reference to a function or procedure that is contained within another application, FoxPro is unable to resolve the external reference. The Build function will display the following error message:

Unable to Find Proc./Func.



RESOLUTION
At the bottom of the file, create a procedure stub that references the external function.

Additional ways to resolve this problem and their advantages and disadvantages are explained at the end of the "More Information" section below.

NOTE: Using the EXTERNAL PROCEDURE compiler directive does not resolve the problem.



MORE INFORMATION
The code example below demonstrates this error. Because the main .APP file makes reference to a procedure stored in another .APP file, the Build function is unable to resolve the reference.   Open a new program file. Name it SUBAPP.PRG and include the following code: PROCEDURE MyFunc WAIT WINDOW 'Myfunc called.'  Save the program, and include it in a new project named SUBAPP.PJX. Save the project, and build an application named SUBAPP.APP.  Create a file named MAINAPP.PRG. Include the following code: EXTERN PROCEDURE MyFunc DO MyFunc IN SubApp.app  Save the program and add it to a new project named MAINAPP.PJX. Save the project and build an application named MAINAPP.APP.

During the build, as FoxPro is attempting to resolve external references, an alert will appear with the following text:

Unable to Find Proc./Func. MYFUNC

Locate, Ignore, Ignore All, Cancel

 In the alert box, choose Locate and choose SUBAPP.APP, which contains the procedure MyFunc. FoxPro will add the application as an excluded application to the project MainApp and complete the build. Run MAINAPP.APP, and the wait window will appear with the text "MyFunc called." Rebuild MAINAPP.PJX. Note that once again the "Unable to Find Proc./Func." alert appears. Attempting to locate SUBAPP.APP again will add yet another copy of the application as an excluded application to the project. You can choose Ignore instead, and FoxPro will rebuild MAINAPP.APP without error.</li></ol>

You can resolve this problem in one of three ways: <ul> Choose Ignore when the Locate alert appears every time you rebuild your project. -or-

</li> Remove the reference to SUBAPP.APP from the MAINAPP project, pack the project, and add a reference to the source program, in this case SUBAPP.PRG, which contains the source code for the procedure MyFunc. -or-

</li>  Add the following code to the end of MAINAPP.PRG: PROCEDURE MyFunc This is a procedure stub that helps FoxPro resolve the external reference. Since the line of code that actually calls the procedure explicitly specifies the file in which the procedure actually resides, it is that procedure (in this case, the procedure in SUBAPP.APP) which will be called. </li></ul>