ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling Example C files with GCC

I would like to control some GPIB devices from a compiled exe. I found the example c files from a Labview2014 install and am trying to compile the example 488query using gcc from the mingw-w64 environment. I really don't know what I am doing with the gcc inputs, I just tried a couple I found in the n4882 example ReadMe. I confirmed %NIEXTCCOMPILERSUPP% is an environmental variable pointing to the directory with decl-32.h, ni488.h, and ni4882.h. Using the following command:

 

gcc -I"%NIEXTCCOMPILERSUPP%\include" 4882query.c -o 4882query.exe

 

I get the following output/error:

 

C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x1e): undefined reference to `SendIFC@4'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x26): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0xbe): undefined reference to `FindLstn@16'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0xc6): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0xf2): undefined reference to `Ibcnt@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x12f): undefined reference to `DevClearList@8'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x137): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x18a): undefined reference to `SendList@20'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x192): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x1fe): undefined reference to `Receive@20'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x206): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x22f): undefined reference to `Ibcnt@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x27e): undefined reference to `ibonl@8'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x29b): undefined reference to `Iberr@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x2af): undefined reference to `Iberr@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x2b6): undefined reference to `Ibsta@0'
C:\Users\KYLEJE~1\AppData\Local\Temp\ccaxpK8i.o:4882query.c:(.text+0x2f4): undefined reference to `ibonl@8'
collect2.exe: error: ld returned 1 exit status

 

I have also tried compiling with as directed in the readme:

 

gcc -I"%NIEXTCCOMPILERSUPP%\include" 4882query.c "%NIEXTCCOMPILERSUPP%\lib32\msvc\ni4882.obj"

 

and I get the following:

 

C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\\lib32\msvc\ni4882.obj: In function `LoadFunction@4':
p:\gpib\software\n:(.text[_LoadFunction@4]+0x9): undefined reference to `_chkstk'
collect2.exe: error: ld returned 1 exit status

 


Any help would be appreciated,
Brett

0 Kudos
Message 1 of 1
(1,435 Views)