Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2007-02-10 22:41:05


Thanks. i still have problem in linking boost thread library.

I have libboost_thread in /usr/lib:

$ ls -la libboost_thread*
-rwxr-xr-x 1 root root 68644 Feb 16 2006 libboost_thread.a*
lrwxrwxrwx 1 root root 25 Jan 5 16:03 libboost_thread.so ->
libboost_thread.so.1.33.1*
-rwxr-xr-x 1 root root 43236 Feb 16 2006 libboost_thread.so.1.33.1*
lrwxrwxrwx 1 root root 25 Jan 5 16:03 libboost_thread.so.2 ->
libboost_thread.so.1.33.1*
[meryl_at_localhost lib]$ pwd
/usr/lib

When i link it, i specified the -L and -l but I still get linker error:

g++ -L/usr/lib -o"sandbox" ./thread.o -llibboost_thread
/usr/bin/ld: cannot find -llibboost_thread
collect2: ld returned 1 exit status
make: *** [sandbox] Error 1
make: Target `all' not remade because of errors.
Build complete for project sandbox

Thanks for any help.

On 2/4/07, James Dennett <jdennett_at_[hidden]> wrote:
> Meryl Silverburgh wrote:
> >
> > On 2/4/07, John Maddock <john_at_[hidden]> wrote:
> >> Meryl Silverburgh wrote:
> >>> i have more information about my problem:
> >>>
> >>> I have add '-L/usr/lib' as my library path during linking and i make
> >>> sure i have 'libboost_thread*' library in '/usr/lib', but it still
> >>> does not work. Any idea why?
> >> This is a compiler issue: you need to tell the compiler that you need to
> >> link to the thread lib with a -lboost_thread.
> >>
> >> John.
> >
> > Thanks but if I specified '-L/usr/lib', won't it links all libraries
> > under '/usr/lib' which includes 'boost_thread'?
> >
> > Thank you.
>
> No, that's not how linkers work. The notion of the
> search path (specified by -L) is separate from the
> choice of which libraries to search for. C++ does
> not have a fixed association from a particular header
> to a fixed library name (unless you use platform-
> specific extensions) -- you can specify the same
> search path, and still fulfill linkage requirements
> in many different ways by specifying different library
> names.
>
> In summary: -L says where to look for named libraries,
> and -l says which named libraries to look for.
>
> -- James
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net