tags:

views:

650

answers:

4

Hi,

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 scope
A: 

try C_INCLUDE_PATH or use -I compiler option

BTW, use LD_LIBRARY_PATH to help find library

aaa
I have set the C_INCLUDE_PATH and CPLUS_PATH, but I still get linking error:: error: undefined reference to 'typeinfo for boost::detail::thread_data_base'I have set $ echo $LD_LIBRARY_PATH/media/data/bin/boost/lib:
n179911
you have to specify library to link to with "-lXXX" flag, make sure you do not have space.of course you will have to replace XXX with the name of the library minus "lib" prefix and without suffix. i do not know the exact library name, you may have to read documentation.LD variable specifies the search path for libraries, but not the library to link to.
aaa
you know what, just try adding -lboost to your compilation/linking command
aaa
+3  A: 

What is wrong with

sudo apt-get install libboost-dev

after which you don't need to set any -I and -L flags. If you need Boost 1.40, you can still rebuild the current Debian unstable package.

Dirk Eddelbuettel
I did not use this because it will put boost in my main drive, which I am running out of space. So I compile/install boost in my external hard drive (which has much more space than my main drive).
n179911
A: 

Check that headers is actually there:

/media/data/bin/boost/include/boost/bind.hpp

Also try using -I/media/data/bin/boost/include instead of env variable (notice no space after -I).

Eugene
+1  A: 

To save everybody's time, here's the answer I gave to this question elsewhere: http://permalink.gmane.org/gmane.comp.lib.boost.user/54626

Vladimir Prus