Este contenido no está disponible en su idioma de su preferencia.

El contenido se mostrará en otro idioma disponible. Su navegador puede proporcionar una funcionalidad para ayudarle a traducir el texto.

Undefined Symbol Error When Compiling LabWindows™/CVI Project

Updated Dec 23, 2023

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"

undefsymberror.png

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. Refer to Linking to DLL Defined Functions from LabWindows™/CVI to link your libraries.
  • 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. Visit the Adding Files to Projects section from the LabWindows™/CVI manual for more information regarding how to include these files. 
  • When including static libraries, these errors can occur as C compilers cannot link a static library that references the standard libraries of another compiler, for example, if LabWindows™/CVI tries to link a static library that references the stdlib of VisualStudio, these errors can be reported. Try using dynamically linked libraries (DLLs) instead of the static libraries.
    • To be usable in any compiler, a library needs to be fully statically linked or dynamically linked, with the dependencies present. The latter option is the usual recommendation.
  • If you are using an Instrument Driver from the Tools Library in LabWindows™/CVI or an Instrument Driver for a Third Party hardware, make sure to include the .fp file for that instrument driver in your project. If you add a .fp file to a project, that instrument driver will be loaded automatically each time that the project is loaded.
    • The .fp files of the Tools Library are generally located in C:\Program Files (x86)\National Instruments\CVIxxxx\toolslib\toolbox.
    • For Third Party Instrument drivers, the .fp files are usually located in the corresponding folder of the driver at C:\Program Files (x86)\IVI Foundation\IVI\Drivers.
  • If the error is referencing a DLL or a DLL function, place the referenced DLL 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 .
rtaImage.jpg
  • If the error is persistent after following the above steps, the library files could be damaged. Try copying the library files from a working machine to check if that provides a different outcome.