Tried, didn't make any difference.
$ g++ -v -s -I/usr/include/boost -pthread timer.cpp -o timer -lboost_date_time
Using built-in specs.
Target: i486-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-
4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/i486-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include/g++-v4 --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --disable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --with-arch=i486 --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)
/usr/libexec/gcc/i486-pc-linux-gnu/4.1.2/cc1plus -quiet -v -I/usr/include/boost -D_GNU_SOURCE -D_REENTRANT timer.cpp -quiet -dumpbase timer.cpp -march=i486 -auxbase timer -version -o /tmp/ccMTaEv0.s
ignoring nonexistent directory "/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../../i486-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/boost
/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include/g++-v4
/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include/g++-v4/i486-pc-linux-gnu
/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include/g++-v4/backward
/usr/local/include
/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/include
/usr/include
End of search list.
GNU C++ version 4.1.2 (Gentoo 4.1.2 p1.0.2) (i486-pc-linux-gnu)
compiled by GNU C version 4.1.2 (Gentoo 4.1.2 p1.0.2).
GGC heuristics: --param ggc-min-expand=46 --param ggc-min-heapsize=30755
Compiler executable checksum: 4ca4b00b3bea7fbbb8f68a78703ea1b5
/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../../i486-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccHiGaC0.o /tmp/ccMTaEv0.s
GNU assembler version 2.16.1 (i486-pc-linux-gnu) using BFD version 2.16.1
/usr/libexec/gcc/i486-pc-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o timer -s /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../crt1.o /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../crti.o /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/crtbegin.o -L/usr/lib/gcc/i486-pc-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-pc-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../../i486-pc-linux-gnu/lib -L/usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../.. /tmp/ccHiGaC0.o -lboost_date_time -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/crtend.o /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../crtn.o
/tmp/ccHiGaC0.o: In function `__static_initialization_and_destruction_0(int, int)':
timer.cpp:(.text+0x13b): undefined reference to `boost::system::get_system_category()'
timer.cpp:(.text+0x145): undefined reference to `boost::system::get_posix_category()'
timer.cpp:(.text+0x14f): undefined reference to `boost::system::get_posix_category()'
timer.cpp:(.text+0x159): undefined reference to `boost::system::get_system_category()'
collect2: ld returned 1 exit status
Daniel [daniel.cubetek@gmail.com] wrote:I notice you're putting the library name at the beginning of the command
> Here's the output:
> $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread
./timer.cpp -o ./timer
line. Because of the way g++ parses command lines, it will not actually
link in the library. It goes from left to right and only links in
library components that it already knows it needs. -lboost_date_time is
the first source mentioned, and the linker sees no need to bother with
it, because it hasn't yet seen anything that needs it.
It is best to put libraries at the end of the command line, and you may
need to play with their order if one library depends on another.
Try this:
g++ -v -s -I/usr/include/boost -pthread timer.cpp -o timer
-lboost_date_time_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users