Re: g++ and linker issue



conrad <conrad@xxxxxxxxxx> writes:

My directory /home/foo/bunk contains a shared object(gb.so) and
a C++ source file.
I invoke g++:
g++ -L/home/foo/bunk -o driver driver.cc -lgb
/usr/bin/ld: cannot find -lgb
collect2: ld returned 1 exit status

What am I missing here?

Given above link line, the linker will search /home/foo/bunk and
standard library directories for libgb.so and libgb.a

Since no such file exists, you get the error.

You can name your library correctly:

mv gb.so libgb.so

or create a symlink for it:

ln -s gb.so libgb.so

You may also wish to add '-Wl,-rpath=/home/foo/bunk' to your link
line, so that runtime loader could find your library as well.

Or you could just link the library directly:

g++ -o driver driver.cc /home/foo/bunk/gb.so

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • Re: linker error - undefined functions
    ... funkctions like WSAStartup are undefined). ... linker> general> Additional Library Directories - but no success ...
    (microsoft.public.vstudio.general)
  • Re: Suppress Linking with Default System Libs?
    ... Is there any way to suppress the linker from looking at the default paths? ... Only search library directories explicitly specified on the ... (including linker scripts specified on the command line) ...
    (comp.os.linux.development.apps)
  • Re: linker error - undefined functions
    ... funkctions like WSAStartup are undefined). ... linker> general> Additional Library Directories - but no success ...
    (microsoft.public.vstudio.general)
  • Re: Suppress Linking with Default System Libs?
    ... Is there any way to suppress the linker from looking at the default paths? ... Only search library directories explicitly specified on the ... (including linker scripts specified on the command line) ...
    (comp.os.linux.development.apps)
  • Re: Using user32.dll in C++ mixed mode assembly
    ... I am trying to access GetClientRect from within the ... unmanaged code. ... Library Directories in the Linker to point to the directory with ... I needed to go into Linker, ...
    (microsoft.public.vsnet.ide)