开发者

Problem in setting up boost library on ubuntu

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:开发者_Python百科 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


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.


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

Update 2016-02-11: It is necessary to specify the options directly:

g++ -I<prefix>/include -L <prefix>/lib

or use the right variables:

export CPLUS_INCLUDE_PATH=<prefix>/include
export LIBRARY_PATH=<prefix>/lib


try C_INCLUDE_PATH or use -I compiler option

BTW, use LD_LIBRARY_PATH to help find library


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜