LabVIEW Error 1502 When Building an Application

Updated Aug 1, 2023

Reported In

Software

  • LabVIEW Application Builder Module
  • LabVIEW
  • LabVIEW FPGA Module
  • LabVIEW Sound and Vibration Toolkit
  • LabVIEW State Diagram Toolkit

Issue Details

  • I get error 1502 when trying to build an application with LabVIEW:

An error occurred while building the following file:

<File Path>

The VI became broken during the build process. Open the Build Specification and enable debugging to include the front panel and block diagrams.

 
  • I get Error 1502 when I build one of the LabVIEW Sound and Vibration Toolkit shipping examples. 

Solution

Error 1502 occurs when the Application Builder attempts to load VI dependencies or block diagrams due to a weak link to certain required components. 

There are several settings in the application (EXE) build properties dialog box which typically can help resolve this issue. Changing these settings will significantly increase the compile time, and size of the executable. However, it will not greatly affect execution speed.
 
  • A possible workaround for this type of issue is to Enable debugging in the Advanced category. Checking this option will include block diagrams that will greatly increase the application size (by approximately double), but will usually resolve this error.
 
 
  • Another workaround is to include the front panel and block diagram of the VI that is causing the error.  Navigate to the Source File Settings category and select the VI that is causing the error. Uncheck the Remove block diagram box. If the VI is not listed in the Project Files section, then select Dependencies. Uncheck the Remove front panel and Remove block diagram boxes
 
 
  • Uncheck the following settings in Additional Exclusions as seen in the screenshot below: Disconnect type definitions and Remove unused members of project libraries. 
 
 
  • If you get this error while building an example of the LabVIEW Sound and Vibration Toolkit, make sure that you unchecked the Additional Exclusions mentioned in the previous bullet point, to avoid removing important dependencies used by the toolkit. 
 
  • Another reason this problem could be occurring is if there are dependencies from a previous run time of LabVIEW that have been deprecated for your current version. Perform a mass compile your project following the indications provided in How to Mass Compile in LabVIEW.
 
  • This error is commonly caused by building an application from a VI that has code that will never execute, for example, having a constant wired to the selector terminal of a case structure. In addition, this may be caused by deleting or removing SubVIs and dependencies from the project that may still be loaded in memory.
    • If you continue to run into issues with your subVIs not executing after resolving this error, try unchecking Remove unused polymorphic VI instances and Disconnect unused inline subVIs under the Additional Exclusions section when building your executable.
 
  • Error 1502 can sometimes also occur if there are Diagram Disable structures or Conditional Structure Code. It is advised to remove from the block diagram any code that will not be used. For example, code that is in the disabled case of a Diagram Disable structure. It is also recommended to explicitly include code from project dependencies.
 
  • If you are seeing this error while building a real-time application that communicates with an FPGA, and it is calling it by bitfile reference, try refreshing the FPGA VI reference in it:
    • In your RT main VI, open the block diagram > right-click the Open FPGA VI Reference Function > Configure > deselect Bitfile >  click OK >  right-click the Open FPGA VI Reference Function > Configure > select Bitfile again to refresh the reference > Save your VI and try building the application again.  
 
  • Error 1502 can occur if you have used LabVIEW State Diagram Toolkit to construct the state machine.
    • Right-Click on the state machine loop > select Unlock Code From Editor Wizard.
    • Find all Integer to Enum nodes and replace them with Variant To Data nodes.
 

 

1. In the LabVIEW project explorer, expand the dependencies, and find the libraries, and classes related to the Report Generation toolkit. Image_2023-03-07_17-53-40.png

2. Right-click on the class/library and select explore.

 

Image_2023-03-07_17-54-03.png

 

After the second step, the window from the File explorer should be opened.

Image_2023-03-07_17-54-39.png

3. Drag and drop the mentioned libraries/classes into the LabVIEW project.

4. Create a new executable and add the mentioned libraries and classes into the Always included tab.

5. Build the executable.

 

Note: If during the creation of the executable, you will receive the error related to the broken VIs, open the VIs by using the path mentioned in the error window, find the grayed-out invoke node, right-click on the invoke node and select Relink invoke node.

Additional Information

When building an application, the first step that LabVIEW does, is to make a copy of the code as a source distribution to a new directory, along with changing settings for the purpose of compiling into a single EXE file. Error 1502 occurs when something in that process goes wrong. This is caused by weak links which can occur from several things such as: Diagram Disable Structures, bad dependencies, etc..