Problem setting up boost library on ubuntu

I compiled and installed my boost library in '/ media / data / bin' in ubuntu 9.10. And I set 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
+3
source share
4 answers

What is wrong with

sudo apt-get install libboost-dev

after which you do not need to set the flags -Iand -L. If you need Boost 1.40, you can rebuild the current unstable Debian package.

+10
source

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

2016-02-11: :

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

:

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

try C_INCLUDE_PATH or use the -I option of the compiler

BTW, use LD_LIBRARY_PATH to help find the library

0
source

Make sure there are actually headers:

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

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

0
source

Source: https://habr.com/ru/post/1726943/


All Articles