No, that is not right. If you look at his file listing, he obviously does have libboost_thread installed. -lxx causes the linker to look first for libxx.so and then libxx.a, unless you override that default by specifying the appropriate actions. In this case, with -lboost_thread, it's going to look for libboost_thread.so and then libboost_thread.a. However, neither of them exists - instead, you have libboost_thread.so.1. Create a symbolic link in /usr/lib named libboost_thread.so to libboost_thread.so.1, and you should be OK. For example, execute the following commands: su (must be logged in as root) cd /usr/bin ln -s libboost_thread.so.1 libboost_thread.so Cheers, Lyle -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of Ishwar Rattan Sent: Monday, August 09, 2004 4:51 PM To: Mattias Brändström Cc: gcc-help@xxxxxxxxxxx Subject: Re: Confused about linking -lxx implies that libxx.a exists in the specified path, has nothing to do with shared libraries. Install libboost-thread first! -ishwar On Mon, 9 Aug 2004, [ISO-8859-1] Mattias Brändström wrote: > Hello! > > I am seriously confused when it comes to linking my executable written > in C++. More specificaly I want to link againts boost_thread and > boost_regex on a Fedora 2 system. > > These files are located in /usr/lib: > > /usr/lib/libboost_thread.so.1 > /usr/lib/libboost_thread.so.1.31.0 > /usr/lib/libboost_regex.a > /usr/lib/libboost_regex.so.1.31.0 > /usr/lib/libboost_regex.so.1 > > I have a small file named 'foo.cpp' containing the following: > > int main() > { > return 0; > } > > When I try the following: > > g++ foo.cpp -L/usr/lib -lboost_regex > > everthing works fine. But when I do this: > > g++ foo.cpp -L/usr/lib -lboost_thread > > I get: > > /usr/bin/ld: cannot find -lboost_thread > collect2: ld returned 1 exit status > > When removing /usr/lib/libboost_regex.a I get the same error as above > when trying to 'g++ foo.cpp -L/usr/lib -lboost_regex'. > > I was under the impression that g++ would look for shared librarires and > try to link againt them first and if that didn't work try to link againt > static libraries. Perhaps this is not tha case? Can someone enlighten me > on this, probalbly trivial, issue? > > Thanks in advance! > > :.:: mattias > > PS. > > g++ -v foo.cpp -L/usr/lib -lboost_thread > > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man > --infodir=/usr/share/info --enable-shared --enable-threads=posix > --disable-checking --disable-libunwind-exceptions --with-system-zlib > --enable-__cxa_atexit --host=i386-redhat-linux > Thread model: posix > gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/cc1plus -quiet -v > -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D_GNU_SOURCE > foo.cpp -D__GNUG__=3 -quiet -dumpbase foo.cpp -auxbase foo -version -o > /tmp/cccCYtHd.s > GNU C++ version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) (i386-redhat-linux) > compiled by GNU C version 3.3.3 20040412 (Red Hat Linux 3.3.3-7). > GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64549 > ignoring nonexistent directory "/usr/i386-redhat-linux/include" > #include "..." search starts here: > #include <...> search starts here: > /usr/include/c++/3.3.3 > /usr/include/c++/3.3.3/i386-redhat-linux > /usr/include/c++/3.3.3/backward > /usr/local/include > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/include > /usr/include > End of search list. > as -V -Qy -o /tmp/ccqqpjhi.o /tmp/cccCYtHd.s > GNU assembler version 2.15.90.0.3 (i386-redhat-linux) using BFD version > 2.15.90.0.3 20040415 > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/collect2 --eh-frame-hdr -m > elf_i386 -dynamic-linker /lib/ld-linux.so.2 > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crti.o > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/crtbegin.o -L/usr/lib > -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.3 > -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../.. /tmp/ccqqpjhi.o > -lboost_thread -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/crtend.o > /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crtn.o > /usr/bin/ld: cannot find -lboost_thread > collect2: ld returned 1 exit status >