C ++ boost Library
1. Install Boost in freebsd
Dp @ dp :~ % Ftp http://jaist.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.gz.
Dp @ dp :~ % Tar jxvf boost_000055_0.tar.gz
Dp @ dp :~ % Su
Root @ dp:/home/dp # cd boost_000055_0
Root @ dp:/home/dp/boost_000055_0 #./bootstrap. sh
Root @ dp:/home/dp/boost_000055_0 #./bjam
Root @ dp:/home/dp/boost_000055_0 # ldconfig
Root @ dp:/home/dp/boost_000055_0 # cd ..
Test whether the installation is successful:
Dp @ dp :~ /Boostlearn % cat 1.cpp
# Include
# Include
Int main ()
{
Using boost: lexical_cast;
Int a = lexical_cast ("210923 ");
Double B = lexical_cast ("4358.56 ");
Std: cout <a <std: endl;
Std: cout <B <std: endl;
Return 0;
}
Then compile the above program:
Compile with g ++
Dp @ dp :~ /Boostlearn % g ++-o boost_test1 1.cpp-I/home/dp/boost_1_55_0
Compile with CC
Dp @ dp :~ /Boostlearn % g ++-o boost_test1 1.cpp-I/home/dp/boost_1_55_0
Note: cc and gcc compile C code files, while CC and g ++ compile C ++ code files.
Last run
Dp @ dp :~ /Boostlearn %./boost_test1
210923
4358.56
Dp @ dp :~ /Boostlearn %./boost_test2
210923
4358.56
Dp @ dp :~ /Boostlearn %