Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Linker error VC 2008

Solved!
Go to solution

Hi All,

 

I have this same problem.

 

I am trying to compile the ni example file "4882query.c" using Visual Studio 6, SP6.  I create a clean project, include ni4882.h, and set the project options to link ni4882.obj.  I get the following link errors:

 

--------------------Configuration: test - Win32 Release--------------------
Compiling...
4882query.c
Linking...
LINK : warning LNK4049: locally defined symbol "_fclose" imported
ni4882.obj : error LNK2001: unresolved external symbol __imp__fread
ni4882.obj : error LNK2001: unresolved external symbol __imp__fopen
ni4882.obj : error LNK2001: unresolved external symbol __imp__rand
ni4882.obj : error LNK2001: unresolved external symbol __imp__srand
ni4882.obj : error LNK2001: unresolved external symbol __imp__time
Release/test.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.

test.exe - 6 error(s), 1 warning(s)

 

As I've already wasted alot of time trying to resolve this, some help would be much appreciated!

 

Adam.

0 Kudos
Message 11 of 24
(2,609 Views)

Hi Adam,

 

Besides adding ni488.2 obj to your project, did you set the compiler option in your project to use the Multithreaded DLL (/MD option if you were compiling on the command line)? If not, you should try setting that option. Here's a link to the Microsoft web site for how to make that setting in a MSVC 6.0 project:

 

http://msdn.microsoft.com/en-us/library/aa278396.aspx

 

Hope this information helps.

 

gpibtester

0 Kudos
Message 12 of 24
(2,602 Views)

Hi gpibtester,

 

Thanks for your suggestions.

 

I have been round this several times and tried just about everything!  The MD option causes a different error, and I still can't get a successful link.

 

In desperation, I tried using earlier versions of the ni files (488), and it worked immediately with no errors.  So then I tried using Visual Studio 2008 with the latest versions of the ni files (488.2) and that also worked.  So it's just MSVC 6.0 with the 488.2 files that won't work.  Very frustrating.  Obviously something is incompatible, but surely there must be some way to do it? !!!

 

Regards,

 

Adam.

 

 

 

 

0 Kudos
Message 13 of 24
(2,586 Views)

Hello,

 

What version of NI-488.2 were you you using that caused the problem, and which version did it work in? Is there a reason you can't use the version that it worked in for your application? 

 

Best Regards,

 

Adam G 

National Instruments
Applications Engineer
0 Kudos
Message 14 of 24
(2,567 Views)

Hi,

 

I try to comunicate with an instrument using a GPIB-USB-B. I have been trying to compile 4882query.c for a while following different posts on the NI

forum... I have tried with different version of VS.

 

Using VS2008, I have created a Windows console project, I have added ni4882.h (16KB)  to the header section and gpib-32.obj (90KB) to the ressource section.

However, I still have problem with linker:

 

 

4882query.obj : error LNK2001: symbole externe non résolu _Ibcnt@0
4882query.obj : error LNK2001: symbole externe non résolu _Ibsta@0
4882query.obj : error LNK2001: symbole externe non résolu _Iberr@0
C:\test\Release\test.exe : fatal error LNK1120: 3 externes non résolus

 

4882query.obj : error LNK2001: symbole externe non résolu _Ibcnt@04882query.obj : error LNK2001: symbole externe non résolu _Ibsta@04882query.obj : error LNK2001: symbole externe non résolu _Iberr@0C:\test\Release\test.exe : fatal error LNK1120: 3 externes non résolus

 

(I use VS in french, but I guess you will know what it means)

 

I have also tried to add ni4882.obj to the ressource section, but at the compilation, this file is not valid ...

 

I really spent long time to find the solution, so it would be great if someone has an idea to help me.

 

Regards,

Paul

 

0 Kudos
Message 15 of 24
(2,404 Views)

Paul,

 

NI-488.2 has 2 APIs, the GPIB-32 API (Legacy) and the newer NI-488.2 API, which are explained in greater detail in Differences between the GPIB32 API and the NI4882 API.

 

Basically, what is going on with your project is that it is mixing the Header file, ni4882.h (for the newer API), with the Legacy object module, gpib-32.obj. The gpib-32.obj does not know about the newer status functions, Ibsta(), Ibcnt(), and Iberr(), which is why you see those errors.

 

The examples are written to use the features in the newer NI-488.2 API. To fix your project so that it compiles with 4882query.c, you need to include the ni4882.obj file along with the ni4882.h file.

 

Hope this information helps.

 

gpibtester

0 Kudos
Message 16 of 24
(2,396 Views)

Thanks gpibtester !

 

I will try as soon as possible !

Could you tell me if I can use it with Linux (Ubuntu) ? In fact, I have to develop a driver to provide measurements to a Linux testbed...

 

Regards

0 Kudos
Message 17 of 24
(2,391 Views)

Paul,

 

At this time, NI-488.2 for Linux only supports the Legacy GPIB-32 API. However, there is a similar example that finds all the GPIB Instruments that are listening on the bus called findinstr.c. By default it is installed into /usr/local/natinst/ni4882/examples/. In that directory, there is a makefile that can be used to compile the two examples using gcc.

 

Also, while ubuntu is not officially supported by NI-488.2 for Linux, if you run into trouble installing it, you can find tips and workarounds on Linux Users Community Group.

 

Hope this information is helpful.

 

gpibtester

0 Kudos
Message 18 of 24
(2,388 Views)

I'm trying to install the driver for GPIB-USB-B (ni488.2) for linux (ubuntu). I have downloaded the driver and run the script "INSTALL". Unfortunately, I get the error message :

 

ERROR : gcc does not appear to be installed!

Installation of gcc is required to continue this installation.

 

I don't understand because gcc is already installed. In compile c files easily.

0 Kudos
Message 19 of 24
(2,371 Views)

Paul,

 

What version of GPIB are you trying to install?

 

What version of ubuntu are you using?

 

gpibtester

0 Kudos
Message 20 of 24
(2,362 Views)