Undefined Symbol Error When Compiling LabWindows™/CVI™ Project

Updated Nov 30, 2022

Reported In

Software

  • LabWindows/CVI

Issue Details

I am trying to compile a LabWindows/CVI project, but I am getting errors that are referenced as Link Error or Undefined Symbol errors.
 
error: Undefined symbol "symbol_name" referenced in "path"

Solution

This type of error can occur for multiple reasons, most of which involve a reference to a function or variable that the linker could not resolve or find a definition for. This can happen when the compiler cannot identify if the symbol is defined since it could be in a different source file or library. In order to fix this type of issue please try the following troubleshooting steps:
  • The most common source of this error is that the object file or library containing the definition of the symbol is not correctly linked. Please make sure that the library that contains the symbol definition referenced in the error message is linked as part of the LabWindows/CVI project.
  • Ensure that the header file (ending in .h) and the import library (.lib) are both included in the LabWindows/CVI project. Also, make sure all the names of functions or variables in the header files (.h) and source code (.c) match. 
  • Place the DLL being referenced in the same directory as your LabWindows/CVI application so that you can determine if LabWindows/CVI is having issues locating the correct DLL.
  • Try to reduce the debug level to the lowest one which will reduce some options but still have debug capabilities. This can be done by clicking on Options >> Build Options >> Debugging Level. Change the Debugging Level to No run-time checking.
  • This error can also happen when porting a LabWindows/CVI application from 32-bit to 64-bit. Please take into consideration that you can load 32- and 64-bit DLLs only into processes with the same bitness. Please make sure that you reconfigure your project to use external DLLs using their 64-bit DLLs. For example, if porting an application that uses the NI-IMAQ driver you need to add this library by selecting Edit >> Add Files to Project >> Library and browse to the 64-bit lib file located at C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\lib64\msvc. Your project should look like the image below. Please note that the NI-IMAQ is not fully supported in 64-bit: NI Vision Development Module and Vision Acquisition Software 64-bit Programming Language Support.
Screenshot_1.png
 

Additional Information

The error has been reported in versions equal to or older than LabWindows CVI 2019, if you are using these versions, you can try updating to a newer version.

Also, if the error is persistent after following the above steps, the library files could be damaged. please try copying the files from a working machine to check if that provides a different outcome.