error while linking to a shared object

Hi,

My application in C is trying to link to a shared object (.so file), but while trying to do so the following error occurs…

/usr/qnx630/host/qnx6/x86/usr/bin/ntox86-ld: cannot find -lbluetooth
collect2: ld returned 1 exit status

I have copied the shared library into /lib and to /usr/lib.

Pls help me out…

thanks
rakesh

my guess is the linker is looking for the library to link statically.

Shared objects are loaded at run time from somewhere in the LD_LIBRARY_PATH setting.
usually /lib:/usr/lib:/lib/dll plus some others.

if you put -Bdynamic -lbluetooth in your build command then it should work.

If not, I suggest you post your build command / makefile.

Are you building from command line or Momentics?

Hi,

Thanks for the reply, but problem still persists :frowning:

I am building it from command line.

I used the command: gcc application.c -lbluetooth

I also tried with -Bdynamic in the build command. Then i got the following error :
usr/qnx630/host/qnx6/x86/usr/bin/ntox86-ld: cannot find -lbluetooth
collect2: ld returned 1 exit status
gcc: file path prefix dynamic never used

thanks
rakesh

Where is your library bluetooth( i am assuming its called libbluetooth.so) located ? try passing in the -L option to the compiler, ex gcc prg.c -L/home/xyz -lbluetooth -o myprog or include the .so directory in LD_LIBRARY_PATH variable

Hope this helps…