Simple Linking Error
I wrote a simple "Hello, world!" program to test if boost/asio was working correctly: #include <iostream> #include <boost/date_time/posix_time/posix_time.hpp> int main() { std::cout << "Hello, world!\n"; return 0; } But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) test.cpp:(.text+0x10b): undefined reference to `boost::system::get_system_category()' test.cpp:(.text+0x115): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x11f): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x129): undefined reference to `boost::system::get_system_category()' This happens when I used '#include <boost/date_time/posix_time/posix_time.hpp>' I can't figure out what I'm missing
Hi Daniel, Where were your boost header files and libraries compiled to? I had similar issues and John Maddock helped me solve a path issue. Try adding -I/path/to/boost to your compile string e.g g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe you might need to add the relevant -lboost_library_name_goes_here to the end of that compile string, where boost_library_name_goes_here is the name of the library you are using. I thought this would be easier on linux than windows to be honest and here you are having some problems ! Hope this helps. Jay Daniel wrote:
I wrote a simple "Hello, world!" program to test if boost/asio was working correctly:
#include <iostream> #include <boost/date_time/posix_time/posix_time.hpp>
int main() { std::cout << "Hello, world!\n"; return 0; }
But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) test.cpp:(.text+0x10b): undefined reference to `boost::system::get_system_category()' test.cpp:(.text+0x115): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x11f): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x129): undefined reference to `boost::system::get_system_category()'
This happens when I used '#include <boost/date_time/posix_time/posix_time.hpp>' I can't figure out what I'm missing
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
including the -I/path/to/boost seemed to do the trick, however, once I started utilizing it (asio/date_time) I started getting things such as undefined reference to `pthread_detach' Code directly taken from the tutorial here: http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer... Is there a list of the exact library names in boost/asio? On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com> wrote:
Hi Daniel,
Where were your boost header files and libraries compiled to? I had similar issues and John Maddock helped me solve a path issue. Try adding
-I/path/to/boost
to your compile string e.g
g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe
you might need to add the relevant -lboost_library_name_goes_here to the end of that compile string, where boost_library_name_goes_here is the name of the library you are using.
I thought this would be easier on linux than windows to be honest and here you are having some problems !
Hope this helps.
Jay
Daniel wrote:
I wrote a simple "Hello, world!" program to test if boost/asio was working correctly:
#include <iostream> #include <boost/date_time/posix_time/posix_time.hpp>
int main() { std::cout << "Hello, world!\n"; return 0; }
But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) test.cpp:(.text+0x10b): undefined reference to `boost::system::get_system_category()' test.cpp:(.text+0x115): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x11f): undefined reference to `boost::system::get_posix_category()' test.cpp:(.text+0x129): undefined reference to `boost::system::get_system_category()'
This happens when I used '#include <boost/date_time/posix_time/posix_time.hpp>' I can't figure out what I'm missing
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Daniel, I just did a little digging, regarding that particular error it has been suggested previously to add -pthread to your compile string. Could you give us more output like what other undefined references there are? Jay Daniel wrote:
including the -I/path/to/boost seemed to do the trick, however, once I started utilizing it (asio/date_time) I started getting things such as undefined reference to `pthread_detach'
Code directly taken from the tutorial here: http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
Is there a list of the exact library names in boost/asio?
On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> wrote:
Hi Daniel,
Where were your boost header files and libraries compiled to? I had similar issues and John Maddock helped me solve a path issue. Try adding
-I/path/to/boost
to your compile string e.g
g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe
you might need to add the relevant -lboost_library_name_goes_here to the end of that compile string, where boost_library_name_goes_here is the name of the library you are using.
I thought this would be easier on linux than windows to be honest and here you are having some problems !
Hope this helps.
Jay
Daniel wrote: > I wrote a simple "Hello, world!" program to test if boost/asio was > working correctly: > > #include <iostream> > #include <boost/date_time/posix_time/posix_time.hpp> > > int main() > { > std::cout << "Hello, world!\n"; > return 0; > } > > But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) > test.cpp:(.text+0x10b): undefined reference to > `boost::system::get_system_category()' > test.cpp:(.text+0x115): undefined reference to > `boost::system::get_posix_category()' > test.cpp:(.text+0x11f): undefined reference to > `boost::system::get_posix_category()' > test.cpp:(.text+0x129): undefined reference to > `boost::system::get_system_category()' > > > This happens when I used '#include > <boost/date_time/posix_time/posix_time.hpp>' > I can't figure out what I'm missing > > > ------------------------------------------------------------------------ > > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Here's the output: $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer 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/cc9RRPjp.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/ccgiUm3Z.o /tmp/cc9RRPjp.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/../../.. -lboost_date_time /tmp/ccgiUm3Z.o -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/ccgiUm3Z.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 On Nov 29, 2007 12:06 PM, <jayc.lawrence@gmail.com> wrote:
Hi Daniel,
I just did a little digging, regarding that particular error it has been suggested previously to add -pthread to your compile string. Could you give us more output like what other undefined references there are?
Jay
Daniel wrote:
including the -I/path/to/boost seemed to do the trick, however, once I started utilizing it (asio/date_time) I started getting things such as undefined reference to `pthread_detach'
Code directly taken from the tutorial here:
http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
Is there a list of the exact library names in boost/asio?
On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> wrote:
Hi Daniel,
Where were your boost header files and libraries compiled to? I had similar issues and John Maddock helped me solve a path issue. Try
adding
-I/path/to/boost
to your compile string e.g
g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe
you might need to add the relevant -lboost_library_name_goes_here to
the
end of that compile string, where boost_library_name_goes_here is
the
name of the library you are using.
I thought this would be easier on linux than windows to be honest
and
here you are having some problems !
Hope this helps.
Jay
Daniel wrote: > I wrote a simple "Hello, world!" program to test if boost/asio
was
> working correctly: > > #include <iostream> > #include <boost/date_time/posix_time/posix_time.hpp> > > int main() > { > std::cout << "Hello, world!\n"; > return 0; > } > > But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) > test.cpp:(.text+0x10b): undefined reference to > `boost::system::get_system_category()' > test.cpp:(.text+0x115): undefined reference to > `boost::system::get_posix_category()' > test.cpp:(.text+0x11f): undefined reference to > `boost::system::get_posix_category()' > test.cpp:(.text+0x129): undefined reference to > `boost::system::get_system_category()' > > > This happens when I used '#include > <boost/date_time/posix_time/posix_time.hpp>' > I can't figure out what I'm missing > > >
------------------------------------------------------------------------
> > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Daniel, Try adding -lboost_system to your compile line. Jay Daniel wrote:
Here's the output: $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer 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/cc9RRPjp.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/ccgiUm3Z.o /tmp/cc9RRPjp.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/../../.. -lboost_date_time /tmp/ccgiUm3Z.o -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/ccgiUm3Z.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
On Nov 29, 2007 12:06 PM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> wrote:
Hi Daniel,
I just did a little digging, regarding that particular error it has been suggested previously to add -pthread to your compile string. Could you give us more output like what other undefined references there are?
Jay
Daniel wrote: > including the -I/path/to/boost seemed to do the trick, however, once I > started utilizing it (asio/date_time) I started getting things such as > undefined reference to `pthread_detach' > > Code directly taken from the tutorial here: > http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer... <http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer1src.html> > > Is there a list of the exact library names in boost/asio? > > On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com> > <mailto:jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>>> wrote: > > Hi Daniel, > > Where were your boost header files and libraries compiled to? I had > similar issues and John Maddock helped me solve a path issue. Try adding > > -I/path/to/boost > > to your compile string e.g > > g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe > > you might need to add the relevant -lboost_library_name_goes_here to the > end of that compile string, where boost_library_name_goes_here is the > name of the library you are using. > > I thought this would be easier on linux than windows to be honest and > here you are having some problems ! > > Hope this helps. > > Jay > > Daniel wrote: > > I wrote a simple "Hello, world!" program to test if boost/asio was > > working correctly: > > > > #include <iostream> > > #include <boost/date_time/posix_time/posix_time.hpp> > > > > int main() > > { > > std::cout << "Hello, world!\n"; > > return 0; > > } > > > > But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) > > test.cpp:(.text+0x10b): undefined reference to > > `boost::system::get_system_category()' > > test.cpp:(.text+0x115): undefined reference to > > `boost::system::get_posix_category()' > > test.cpp:(.text+0x11f): undefined reference to > > `boost::system::get_posix_category()' > > test.cpp:(.text+0x129): undefined reference to > > `boost::system::get_system_category()' > > > > > > This happens when I used '#include > > <boost/date_time/posix_time/posix_time.hpp>' > > I can't figure out what I'm missing > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Boost-users mailing list > > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto: Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto: Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > > > ------------------------------------------------------------------------
> > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
That's not in the library list (http://boost.org/libs/libraries.htm) But I tried anyway, and it didn't work, as expected: /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../../i486-pc-linux-gnu/bin/ld: cannot find -lboost_system On Nov 29, 2007 12:34 PM, <jayc.lawrence@gmail.com> wrote:
Hi Daniel,
Try adding -lboost_system to your compile line.
Jay
Daniel wrote:
Here's the output: $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer 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/cc9RRPjp.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/ccgiUm3Z.o /tmp/cc9RRPjp.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/../../.. -lboost_date_time /tmp/ccgiUm3Z.o -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/ccgiUm3Z.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
On Nov 29, 2007 12:06 PM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> wrote:
Hi Daniel,
I just did a little digging, regarding that particular error it has been suggested previously to add -pthread to your compile string. Could you give us more output like what other undefined references there are?
Jay
Daniel wrote: > including the -I/path/to/boost seemed to do the trick, however, once I > started utilizing it (asio/date_time) I started getting things such as > undefined reference to `pthread_detach' > > Code directly taken from the tutorial here: >
http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
<
http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
> > Is there a list of the exact library names in boost/asio? > > On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com> > <mailto:jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>>> wrote: > > Hi Daniel, > > Where were your boost header files and libraries compiled to? I had > similar issues and John Maddock helped me solve a path issue. Try adding > > -I/path/to/boost > > to your compile string e.g > > g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe > > you might need to add the relevant -lboost_library_name_goes_here to the > end of that compile string, where boost_library_name_goes_here is the > name of the library you are using. > > I thought this would be easier on linux than windows to be honest and > here you are having some problems ! > > Hope this helps. > > Jay > > Daniel wrote: > > I wrote a simple "Hello, world!" program to test if boost/asio was > > working correctly: > > > > #include <iostream> > > #include <boost/date_time/posix_time/posix_time.hpp> > > > > int main() > > { > > std::cout << "Hello, world!\n"; > > return 0; > > } > > > > But, I get this: (GCC C++ 4.1.2/Linux version 2.6.22-gentoo-r8) > > test.cpp:(.text+0x10b): undefined reference to > > `boost::system::get_system_category()' > > test.cpp:(.text+0x115): undefined reference to > > `boost::system::get_posix_category()' > > test.cpp:(.text+0x11f): undefined reference to > > `boost::system::get_posix_category()' > > test.cpp:(.text+0x129): undefined reference to > > `boost::system::get_system_category()' > > > > > > This happens when I used '#include > > <boost/date_time/posix_time/posix_time.hpp>' > > I can't figure out what I'm missing > > > > > > >
------------------------------------------------------------------------
> > > > _______________________________________________ > > Boost-users mailing list > > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto: Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto: Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > > >
------------------------------------------------------------------------
> > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Daniel, I am stumped on this one, hope Andrew helps ;) Jay Daniel wrote:
That's not in the library list (http://boost.org/libs/libraries.htm) But I tried anyway, and it didn't work, as expected: /usr/lib/gcc/i486-pc-linux-gnu/4.1.2/../../../../i486-pc-linux-gnu/bin/ld: cannot find -lboost_system
On Nov 29, 2007 12:34 PM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> wrote:
Hi Daniel,
Try adding -lboost_system to your compile line.
Jay
Daniel wrote: > Here's the output: > $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp > -o ./timer > 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/cc9RRPjp.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/ccgiUm3Z.o /tmp/cc9RRPjp.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/../../.. -lboost_date_time > /tmp/ccgiUm3Z.o -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/ccgiUm3Z.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 > > On Nov 29, 2007 12:06 PM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com> > <mailto: jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>>> wrote: > > Hi Daniel, > > I just did a little digging, regarding that particular error it has been > suggested previously to add -pthread to your compile string. Could you > give us more output like what other undefined references there are? > > Jay > > Daniel wrote: > > including the -I/path/to/boost seemed to do the trick, however, > once I > > started utilizing it (asio/date_time) I started getting things > such as > > undefined reference to `pthread_detach' > > > > Code directly taken from the tutorial here: > > > http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer... <http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer1src.html> > <http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer... > > > > > Is there a list of the exact library names in boost/asio? > > > > On Nov 29, 2007 11:27 AM, <jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com> > <mailto:jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>> > > <mailto:jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com> > <mailto: jayc.lawrence@gmail.com <mailto:jayc.lawrence@gmail.com>>>> wrote: > > > > Hi Daniel, > > > > Where were your boost header files and libraries compiled to? > I had > > similar issues and John Maddock helped me solve a path issue. > Try adding > > > > -I/path/to/boost > > > > to your compile string e.g > > > > g++ -v -s -I/path/to/boost myfile.cpp -o myfile.exe > > > > you might need to add the relevant > -lboost_library_name_goes_here to the > > end of that compile string, where > boost_library_name_goes_here is the > > name of the library you are using. > > > > I thought this would be easier on linux than windows to be > honest and > > here you are having some problems ! > > > > Hope this helps. > > > > Jay > > > > Daniel wrote: > > > I wrote a simple "Hello, world!" program to test if > boost/asio was > > > working correctly: > > > > > > #include <iostream> > > > #include <boost/date_time/posix_time/posix_time.hpp> > > > > > > int main() > > > { > > > std::cout << "Hello, world!\n"; > > > return 0; > > > } > > > > > > But, I get this: (GCC C++ 4.1.2/Linux version > 2.6.22-gentoo-r8) > > > test.cpp:(.text+0x10b): undefined reference to > > > `boost::system::get_system_category()' > > > test.cpp:(.text+0x115): undefined reference to > > > `boost::system::get_posix_category()' > > > test.cpp:(.text+0x11f): undefined reference to > > > `boost::system::get_posix_category()' > > > test.cpp:(.text+0x129): undefined reference to > > > `boost::system::get_system_category()' > > > > > > > > > This happens when I used '#include > > > <boost/date_time/posix_time/posix_time.hpp>' > > > I can't figure out what I'm missing > > > > > > > > > > > > ------------------------------------------------------------------------
> > > > > > _______________________________________________ > > > Boost-users mailing list > > > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > <mailto:Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> <mailto: > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto:Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>>> > > > http://lists.boost.org/mailman/listinfo.cgi/boost-users > <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > > > _______________________________________________ > > Boost-users mailing list > > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > <mailto:Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> <mailto: > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto:Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>>> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > < http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > > > > > > > > ------------------------------------------------------------------------ > > > > > _______________________________________________ > > Boost-users mailing list > > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto:Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users> > > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> <mailto: Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>> > http://lists.boost.org/mailman/listinfo.cgi/boost-users > > > > ------------------------------------------------------------------------
> > _______________________________________________ > Boost-users mailing list > Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
jayc.lawrence@gmail.com wrote:
Hi Daniel,
I am stumped on this one, hope Andrew helps ;)
Jay
Unfortunately, I can't really provide any help. I don't have any access to a Linux machine, and search of the boost directory in my Windows machine had no hits for either of those functions. I'll check my Macintosh when I get home; maybe that is close enough. Daniel, could you send me a private email with timer.cpp, or another file that has this problem?
Code directly taken from the tutorial here: http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer... Am I supossed to have a boost_thread library? A google search revealed that the gentoo package didn't have it correctly set up, wondering if this could be the cause of the problem? On Nov 29, 2007 1:24 PM, Andrew Holden <aholden@charteroaksystems.com> wrote:
jayc.lawrence@gmail.com wrote:
Hi Daniel,
I am stumped on this one, hope Andrew helps ;)
Jay
Unfortunately, I can't really provide any help. I don't have any access to a Linux machine, and search of the boost directory in my Windows machine had no hits for either of those functions. I'll check my Macintosh when I get home; maybe that is close enough.
Daniel, could you send me a private email with timer.cpp, or another file that has this problem? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Daniel wrote:
Code directly taken from the tutorial here: http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
Am I supossed to have a boost_thread library? A google search revealed that the gentoo package didn't have it correctly set up, wondering if this could be the cause of the problem?
I just tried the following (with Linux, gcc 3.4.3) on the latest boost development trunk, maybe this will help you: 1. Build all boost libraries as static library with multi-threading enabled:
export BOOST_HOME=~/net/src/boost/devel/trunk cd $BOOST_HOME bjam debug link=static threading=multi stage
2. Compile and link asio tutorial example timer1:
cd libs/asio/example/tutorial/timer1 g++ -pthread -I $BOOST_HOME -o timer1 timer.cpp -L $BOOST_HOME/stage/lib -lboost_system-gcc34-mt-d ./timer1 Hello, world!
IOW, you only need to link to the boost system library, no other boost libs are needed. HTH, Markus
How do I re-build all the libraries like that, on gentoo, without using boost-build? On Nov 30, 2007 5:39 AM, Markus Schöpflin <markus.schoepflin@comsoft.de> wrote:
Daniel wrote:
Code directly taken from the tutorial here:
http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer...
Am I supossed to have a boost_thread library? A google search revealed
that
the gentoo package didn't have it correctly set up, wondering if this could be the cause of the problem?
I just tried the following (with Linux, gcc 3.4.3) on the latest boost development trunk, maybe this will help you:
1. Build all boost libraries as static library with multi-threading enabled:
export BOOST_HOME=~/net/src/boost/devel/trunk cd $BOOST_HOME bjam debug link=static threading=multi stage
2. Compile and link asio tutorial example timer1:
cd libs/asio/example/tutorial/timer1 g++ -pthread -I $BOOST_HOME -o timer1 timer.cpp -L $BOOST_HOME/stage/lib -lboost_system-gcc34-mt-d ./timer1 Hello, world!
IOW, you only need to link to the boost system library, no other boost libs are needed.
HTH, Markus
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Daniel wrote:
How do I re-build all the libraries like that, on gentoo, without using boost-build?
I'm sorry, but I have no idea. I would recommend that you just download the latest boost release (or a snapshot of the current trunk) and compile the libs using boost.build, as shown in my last message. Markus
Daniel [daniel.cubetek@gmail.com] wrote:
Here's the output: $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer
I notice you're putting the library name at the beginning of the command 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
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 On Nov 29, 2007 1:01 PM, Andrew Holden <aholden@charteroaksystems.com> wrote:
Daniel [daniel.cubetek@gmail.com] wrote:
Here's the output: $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer
I notice you're putting the library name at the beginning of the command 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
Daniel, This may be some use to you: http://svn.boost.org/trac/boost/browser/branches/libs/system Best, Jay Daniel wrote:
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
On Nov 29, 2007 1:01 PM, Andrew Holden <aholden@charteroaksystems.com <mailto:aholden@charteroaksystems.com>> wrote:
Daniel [daniel.cubetek@gmail.com <mailto:daniel.cubetek@gmail.com>] wrote: > Here's the output: > $ g++ -v -s -I/usr/include/boost -lboost_date_time -pthread ./timer.cpp -o ./timer
I notice you're putting the library name at the beginning of the command 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 <mailto:Boost-users@lists.boost.org> http://lists.boost.org/mailman/listinfo.cgi/boost-users <http://lists.boost.org/mailman/listinfo.cgi/boost-users>
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Andrew Holden
-
Daniel
-
jayc.lawrence@gmail.com
-
Markus Schöpflin