Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

error when using example code

Hi all,
 
im trying to create a program for communication over a LAN network with a spectrum analyser.
when i use a standard example code i get errors like this one:
 
[Linker error] undefined reference to `viOpenDefaultRM@4'
 
did i made a fault in linking?
0 Kudos
Message 1 of 8
(8,008 Views)
some more information:

i try to make a connection with a spectrum analyser from R&S (FSL)
i cant see the device with NI SPY, but dont know how to do that..
 
if you have a question, ask, i will answer
0 Kudos
Message 2 of 8
(8,001 Views)

Ok.

I've managed to get further, using this example: http://www.rohde-schwarz.com/www/rs_sc.nsf/faq/FSPxAnalyzerre.html
problem is, this is Visual Basic in Excel, and I would really like to use it in the language C in another enviroment.

does anyone have any tips?

0 Kudos
Message 3 of 8
(7,990 Views)
Hi,
 
Can you please be a bit more clear on what you like to do? You like to use NI-VISA in Measurement Studio? Which Compiler / Language are you using?
 
Thanks
Karsten
 
0 Kudos
Message 4 of 8
(7,986 Views)
well, I dont know with program to use, I tried DEV C++ because its a free program i used to work with, but i guess that one doesn't work.
right now the connection is ok, problem is, i use the microsoft excel program, using macro's in the visual basic language.
 
what i want is to get the connection up and running in a program where i can program in the C language.
  
0 Kudos
Message 5 of 8
(7,982 Views)

DAV C++ uses a GCC based compiler. The VISA DLL is compiled with MSVC. This will cause a problem with the calling convertions used and expected.

Basiclly the visa DLL uses 'viOpenDefaultRM' but the GCC expects viOpenDefaultRM@4, and thus can't find it in the DLL. You can solve this manually.

The basic steps are:

1. Generate a .def file from the DLL for example with pexports.

2. correct the .def file so all the functions have the correct decorations as expected by GCC.

3. Create a new import library,

For more infomation see this post about the same issue with NI-DAQmx

An other option would be to use the Visual Studio 2005 express editions?

And in some configuration you will need to buy a license to use NI-VISA: http://www.ni.com/visa/license.htm

Hope this helps

Karsten

Message 6 of 8
(7,976 Views)
I've decided to work with Visual Studio 2005 express editions, because that's a lot easier, I thought.
 
I have a problem when I want to add a reference to the VISA.dll file, I get the following error:
A reference to 'VISA library' could not register the ActiveX type library 'C:\WINDOWS\system32\visa32.dll'
 
 
0 Kudos
Message 7 of 8
(7,961 Views)
Hi,
 
When Using the Visual Studio Express editions I would advise to use the Native .Net support of NI-VISA.
 
When you Install NI-VISA make sure that you install support for the .Net Framework 2.0. When this is installed you should be able to add the "NationalInstrumts VisaNS" namespace to your program.
 
You can find the documentation trough Start -> Programs -> National Instruments -> VISA -> Documantation -> NI-VISA .Net Framework 2.0 Help.
 
Thanks
Karsten
0 Kudos
Message 8 of 8
(7,952 Views)