PRB: Unable to Find Proc./Func. <Name>

Article translations Article translations
Article ID: 102586 - View products that this article applies to.
This article was previously published under Q102586
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

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. <name>

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 <name> 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.
  1. Open a new program file. Name it SUBAPP.PRG and include the following code:
          PROCEDURE MyFunc
          WAIT WINDOW 'Myfunc called.'
  2. Save the program, and include it in a new project named SUBAPP.PJX. Save the project, and build an application named SUBAPP.APP.
  3. Create a file named MAINAPP.PRG. Include the following code:
          EXTERN PROCEDURE MyFunc
          DO MyFunc IN SubApp.app
  4. 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
  5. 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."
  6. 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.
You can resolve this problem in one of three ways:
  • Choose Ignore when the Locate alert appears every time you rebuild your project. -or-

  • 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-

  • 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.

Notes

Both the second and the third options will eliminate the problem. However, while the second option requires the source code to be available and that it be built into the application, increasing its size, the third option requires that the entire called application that includes the single function be sent along with the calling application. If the source code to the function is not available, and you would like to avoid the alert box, use the third method.

Properties

Article ID: 102586 - Last Review: February 28, 2014 - Revision: 2.1
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
Keywords: 
kbnosurvey kbarchive kberrmsg KB102586

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com