12-03-2010 05:00 AM
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.
12-03-2010 12:48 PM
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
12-05-2010 06:05 AM
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.
12-06-2010 09:44 AM
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
04-12-2011 03:45 AM
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@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
04-12-2011 10:08 AM - last edited on 05-19-2024 04:38 PM by Content Cleaner
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
04-12-2011 10:39 AM
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
04-12-2011 11:27 AM - last edited on 05-19-2024 04:40 PM by Content Cleaner
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
04-14-2011 06:21 AM
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.
04-14-2011 08:32 AM
Paul,
What version of GPIB are you trying to install?
What version of ubuntu are you using?
gpibtester