Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Why do I get a linker error (LNK 2019) when using NI-488.2 driver in Microsoft Visual C\C++?

Primary Software: Driver Software>>NI-488.2
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: GPIB

Problem:
I am using the NI-488.2 Driver in Microsoft Visual C\C++ and have included ni4882.h as instructed in the help file. However when I attempt to compile this I get link error LNK 2019: unresolved external symbol. How can I compile my project?


Solution:
As well as including the header file found at C:\Program Files\National Instruments\Shared\ExternalCompilerSupport\C\Headers\ni4882.h you need to include the object file as well. This is ni4882.obj and is located in C:\Program Files\National Instruments\Shared\ExternalCompilerSupport\C\Lib32\ni4882.obj. There are three methods of including this.
  1. Create the project as a Measurement Studio project.

    When you create a Measurement Studio project it will set up the include files for you and this will not be a problem.

  2. Include the file in your project.

    In your project add the object file (C:\Program Files\National Instruments\Shared\ExternalCompilerSupport\C\Lib32\ni4882.obj)

  3. Include the file in the linker options.

    1. In Visual Studio open Project»Properties.
    2. Select linker in the tree diagram.
    3. In command line enter %NIEXTCCOMPILERSUPP%\lib32\msvc\ni4882.obj
      This environmental variable points at the external compiler support folder as used in option two as well.

     The project should now compile and link successfully.   



Related Links:

KnowledgeBase 3RK9PBIZ: Where Do I Find the ni488.h Header File Required By Microsoft Studio Visual C/C++?

KnowledgeBase 488DF36S: NI-DAQmx, NI-VISA, and NI-488.2 Visual C++ Example Locations
KnowledgeBase 3CHC5G5B: VISA and GPIB Application Development Using C# or VB.NET



Attachments:





Report Date: 05/12/2009
Last Updated: 05/29/2009
Document ID: 4XB9OVBN

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit