Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

undefined reference to `dlopen'


i encountered this problem when i attempted to link my program to cib.o using gcc
my NI driver version is 2.2


>gcc test02.c cib.o


This is the error during linking:

[code]
/usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: warning: i386 architecture of input file `cib.o' is incompatible with i386:x86-64 output
cib.o: In function `LoadFunction':
cib.c:(.text+0x2d): undefined reference to `dlopen'
cib.c:(.text+0x59): undefined reference to `dlopen'
cib.c:(.text+0xcd): undefined reference to `dlsym'
cib.o: In function `FreeGpibLibrary':
cib.c:(.text+0x3a68): undefined reference to `dlclose'
collect2: ld returned 1 exit status
[/code]

i m currently using suse 10.1.
I realized that these dl functions have something to do with dlfcn..but i have no idea where are these functions located..



0 Kudos
Message 1 of 4
(4,356 Views)
Hi,

From your explanation I assume you are using NI-488.2 version 2.2 and an NI GPIB board. Just a couple things to check. Can you run one of the examples that are installed with the driver? They are located in the directory that you installed NI-488.2 in, from there go to the NI-488.2 folder and then to the examples folder. Try running one of these and let me know if it works properly.


Message Edited by Krista S on 06-21-2007 10:53 AM


Regards
Krista S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(4,325 Views)
To solve the problem with dlopen,  you have to link with libdl ( by adding -ldl to the compiler flags).
 
But there is another problem:
warning: i386 architecture of input file `cib.o' is incompatible with i386:x86-64
You are using a 64bit development environment but cib.o is 32bit objectcode. You have either switch to a 32bit development environment  or you will have to get a 64bit version of cib.o to get it working.
0 Kudos
Message 3 of 4
(4,315 Views)

@tensaix2j wrote:

/usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: warning: i386 architecture of input file `cib.o' is incompatible with i386:x86-64 output


It looks like you are running a 64-bit version of SUSE (x86_64). NI does not support 64-bit Linux kernels so you will have to switch to i386 to use NI products.

Regards Johan

Edit: Oooops, duplicate information. Didn't see markus kossmanns post above...

Message Edited by JHn on 06-25-2007 02:45 PM

0 Kudos
Message 4 of 4
(4,288 Views)