I made a custom error file for my application using LabVIEW 7.0 for SPARC. Usually this file resides in <Labview Dir>/user.lib. When I am running the LV environment, it always uses the custom error file without issue. When I compile my application into an executable using application builder, I included this errors file in my build project. When the executable is generated, a new user.lib directory is created in the same directory where the executable was installed. The error file is there and looks fine. Unfortunately when I run the executable, it cannot find the custom errors file.
Try putting a temporary indicator in yuor executable build to see the path to where your executable thinks your file is. Then you can see what is wrong in the path and begin debugging your issue.
The problem is that I am not sure where the executable is looking. When an error occurs, an error message pops up and says "there is no definition for this error". When I am using the regular LV environment, it always finds my custom errors file in <labview directory>/user.lib, and the error message contains my custom error message from the file. When I build the application, even though I let the application builder place the errors file, the application cannot find it or cannot use it for some reason.
I understand what you are saying. What you need to do is somehow debug the path when you executable is running. That is why I suggested you make a temporary path indicator on your top level VI. that way when it runs you can see the path it is trying to use. Then compare that path to the actual path and correct any descrepencies in your source code.
Is there a "errors path" constant that I can wire to an indicator? I am not sure how to get the path it is trying to use so I can wire it to the indicator.
From the LabVIEW Help:
If a VI that you want to distribute as part of a stand-alone application or shared library uses custom error codes in XML-based text files, you must distribute those files with the application or shared library so the error handling VIs can use them.
If you want to include custom error codes, add the error code files to the Always Included listbox on the Source Files page of the Application Properties dialog box or the Source Files page of the Shared Library Properties dialog box.
You also can include LabVIEW error codes. From the Advanced page of the Application Properties dialog box, place a checkmark in the Copy error code files checkbox to include LabVIEW error code files in the application. From the Advanced page of the Shared Library Properties dialog box, place a checkmark in the Copy error code files checkbox to include LabVIEW error code files in the shared library.
If you use the Application Builder to create an installer, you can place a checkmark in the Install custom error code files checkbox on the Advanced page of the Installer Properties dialog box to include LabVIEW error code files. The installer build includes all error code files from labview\project\errors and labview\user.lib\errors and installs them in the Shared\LabVIEW Run-Time\x.x\errors directory, where x.x is the version of LabVIEW.
|Note You must manually create an errors folder in the labview\user.lib directory to organize your error code files.|
Ohhhhh.... This is the automatic error handling in LabVIEW that produces some sort of XML error log. I didn't think that was available in executables? Does anyone know otherwise?
Taki and all,
I think he is using LabVIEW 7.0 that predated the use of Projects (*.lvproj) to create Executables. I have not had any problem with finding custom error files with LabVIEW 8.5 and above, but of course this uses the LVPROJ.
Are there any options in the Build utility you use for LabVIEW 7.0 that you are missing to include error code files?
For LV 7.0 the application builder lets you create your own "build file". There is no project manager for LV7.0. The build file lets me tweak a lot of settings. One of the settings is the option to include an errors file. This is an XML file where I define my own errors. For example error 5000 can be set to "hardware no response", error 5001 to "Invalid input data" etc. Then I use these errors in my code using the generate error by number vi. I have included the custom error file in my build file, and the custom error file is in fact generated in a folder that is a subfolder of the location of the executable. For example, my executable is located in /share/programs/program_A, and the errors file is copied to /share/programs/program_A/user.lib/errors/myerrors.xml. Unfortunately, when I run the executable and an error occurs, I see a message like "no error defintion found for error 5000".