Company logo


Advice, tips, techniques and downloads for Visual Foxpro developers.

Home | Contact

Versión en español de este artículo

Tracking down compilation errors

If you get an error message when building your VFP project, how do you know which file to blame?

Have you ever seen the message 'Cannot update the cursor' when building a Visual FoxPro project? This message usually means that VFP cannot compile one of the metadata files (that is, a DBC, form, report, label or class library file). It typically pops up if the file in question is flagged as read-only, or if it is damaged in some way.

If you are using VFP 8.0 or above, the message includes the name of the culprit file. But earlier versions of VFP aren't so helpful - you just get a raw message, then the build process terminates. Figuring out which file caused the problem can be a major headache.

Another message which sometimes rears its head during a build is 'Not a table'. Again, this refers to one of the metadata files, and typically indicates a corrupted file. With luck, the file name will appear in the compilation error log, but this is not always the case.

The solution

To help you identify these problem files, Ted Roche has written a program called WhichOne.Prg. This handy utility compiles all the files in a given project, displaying the file name in a Wait window as it does so. If the compilation process stops for any reason, the Wait window will tell you the name of the file that VFP was attempting to compile at that point.

To make the program even more useful, Barbara Peisch has amended it so that the compilation process does not stop when an error occurs. Instead, the errors are written to a cursor and displayed in a Browse window. This makes it easier for the programmer to track down multiple errors.

How to use it

To use WhichOne.Prg, just open the project that you want to build, then run the program. (If there is no project open when you run it, you will be prompted to open one.)

Keep in mind that WhichOne.Prg only compiles metadata files, not PRGs. The errors that it reports are those that would otherwise stop the compilation. Errors in your code, such as syntax errors, will be written to a log file in the usual way (if SET LOGERRORS is ON). Finally, remember that the program does not actually build the project, that is, it doesn't create an APP or EXE file - it simply compiles the relevant files.

WhichOne.Prg is completely free. To download a copy, click on the link below (the file size is just 4 KB). Our thanks to Ted Roche and Barbara Peisch for making this very useful utility available to Foxstuff visitors.

Download now

Mike Lewis Consultants Ltd. July 2003. Revised January 2006.
Program code © Ted Roche and Barbara Peisch, 2002.

More Visual FoxPro articles | Crystal Reports articles | Recommended books | Visual FoxPro consultancy | Contact us

FoxStuff is maintained by Mike Lewis Consultants Ltd. as a service to the VFP community. Feel free to download and use any code or components, and to pass around copies of the articles (but please do not remove our copyright notices or disclaimers).

The information given on this site has been carefully checked and is believed to be correct, but no legal liability can be accepted for its use. Do not use code, components or techniques unless you are satisfied that they will work correctly in your applications.

© Copyright Mike Lewis Consultants Ltd.