Need help in setting up boost library in ubuntu 9.10

I have compiled and installed my boost library in '/media/data/bin' in ubuntu 9.10. And I have setup the INCLUDE_PATH, LIBRARY_PATH env: $ echo $INCLUDE_PATH /media/data/bin/boost/include: $ echo $LIBRARY_PATH /media/data/bin/boost/lib: But when I compile the asio example, I get the following error: $ g++ blocking_tcp_echo_server.cpp blocking_tcp_echo_server.cpp:13:26: error: boost/bind.hpp: No such file or directory blocking_tcp_echo_server.cpp:14:31: error: boost/smart_ptr.hpp: No such file or directory blocking_tcp_echo_server.cpp:15:26: error: boost/asio.hpp: No such file or directory blocking_tcp_echo_server.cpp:16:28: error: boost/thread.hpp: No such file or directory blocking_tcp_echo_server.cpp:18: error: ‘boost’ has not been declared blocking_tcp_echo_server.cpp:22: error: ‘boost’ has not been declared blocking_tcp_echo_server.cpp:22: error: expected initializer before ‘<’ token blocking_tcp_echo_server.cpp:24: error: variable or field ‘session’ declared void blocking_tcp_echo_server.cpp:24: error: ‘socket_ptr’ was not declared in this sco $ g++ -I/media/data/bin/boost/include -L/media/data/bin/boost/lib blocking_tcp_echo_server.cpp /usr/bin/ld: /tmp/ccBXjXeh.o: in function server(boost::asio::io_service&, short):blocking_tcp_echo_server.cpp(.text+0x39e): error: undefined reference to 'boost::thread::~thread()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function server(boost::asio::io_service&, short):blocking_tcp_echo_server.cpp(.text+0x3c7): error: undefined reference to 'boost::thread::~thread()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function server(boost::asio::io_service&, short):blocking_tcp_echo_server.cpp(.text+0x3d8): error: undefined reference to 'boost::thread::~thread()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function __static_initialization_and_destruction_0(int, int):blocking_tcp_echo_server.cpp(.text+0x5ea): error: undefined reference to 'boost::system::get_system_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function __static_initialization_and_destruction_0(int, int):blocking_tcp_echo_server.cpp(.text+0x5f4): error: undefined reference to 'boost::system::get_generic_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function __static_initialization_and_destruction_0(int, int):blocking_tcp_echo_server.cpp(.text+0x5fe): error: undefined reference to 'boost::system::get_generic_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function __static_initialization_and_destruction_0(int, int):blocking_tcp_echo_server.cpp(.text+0x608): error: undefined reference to 'boost::system::get_generic_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function __static_initialization_and_destruction_0(int, int):blocking_tcp_echo_server.cpp(.text+0x612): error: undefined reference to 'boost::system::get_system_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::system::error_code::error_code():blocking_tcp_echo_server.cpp(.text._ZN5boost6system10error_codeC1Ev+0x10): error: undefined reference to 'boost::system::get_system_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::asio::error::get_system_category():blocking_tcp_echo_server.cpp(.text._ZN5boost4asio5error19get_system_categoryEv+0x7): error: undefined reference to 'boost::system::get_system_category()' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::asio::detail::posix_thread::~posix_thread():blocking_tcp_echo_server.cpp(.text._ZN5boost4asio6detail12posix_threadD1Ev+0x1d): error: undefined reference to 'pthread_detach' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::asio::detail::posix_thread::join():blocking_tcp_echo_server.cpp(.text._ZN5boost4asio6detail12posix_thread4joinEv+0x25): error: undefined reference to 'pthread_join' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::detail::thread_data_base::thread_data_base():blocking_tcp_echo_server.cpp(.text._ZN5boost6detail16thread_data_baseC2Ev+0x1b): error: undefined reference to 'vtable for boost::detail::thread_data_base' /usr/bin/ld: /tmp/ccBXjXeh.o: in function boost::thread::thread<boost::_bi::bind_t<void, void (*)(boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >), boost::_bi::list1<boost::_bi::value<boost::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > > > > >
collect2: ld returned 1 exit status
Thank you.

n179911 wrote:
What makes you think that the INCLUDE_PATH environment variable has any effect? 'man gcc' suggests it does not.
Haven't we been here before? For example, in http://old.nabble.com/Using-boost-library-on-MacOSx-td24645759.html you ask essentially the same questions. There answer here is the same as there -- you don't link to the required libraries, and in this case, it's pretty easy to guess that the required libraries are called Boost.Thread...
... and Boost.System. And you got exactly the same error about Boost.System before. boost::asio::detail::posix_thread::~posix_thread():blocking_tcp_echo_server.cpp(.text._ZN5boost4asio6detail12posix_threadD1Ev+0x1d):
error: undefined reference to 'pthread_detach' /usr/bin/ld: /tmp/ccBXjXeh.o: in function
Add -pthread command line option. - Volodya P.S. I suggest you *do not* ask the same question at the same time both on this mailing list, and on any other web sites. This results in nothing by duplication of effort.
participants (2)
-
n179911
-
Vladimir Prus