Results 1 to 2 of 2
Hello.
I'm quite new with CentOS 6 and everything and I ran into a problem where I don't have boost libraries but should get those. Therefore, I am here to ...
- 12-09-2011 #1Just Joined!
- Join Date
- Dec 2011
- Posts
- 2
[HELP] CentOS 6 Boost libraries
Hello.
I'm quite new with CentOS 6 and everything and I ran into a problem where I don't have boost libraries but should get those. Therefore, I am here to ask where can I get those boost libraries and how do I install them?
I do believe boost, boost-devel and boost-doc weren't those as I installed them but that didn't solve my problem.
So where can I find the files I need to install on the CentOS 6 and how I install them?
Thanks in advance.
- 12-09-2011 #2Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
When I installed CentOS 6 the boost libraries apparently were installed. On my system:
I found a sample program to report the size of a file at: Filesystem TutorialCode:$ yum list boost Loaded plugins: fastestmirror, refresh-packagekit Installed Packages boost.i686 1.41.0-11.el6 @anaconda-centos-201106051823.i386/6.0 v
Here is a short script that reports the context of compiling and running the example. The c++ code is listed, then the compiler is called, and the resulting binary is executed:
producing:Code:#!/usr/bin/env bash # @(#) sh-minimal Demonstrate minimal environment for quick scripts. # Utility functions: print-as-echo, print-line-with-visual-space, debug. # export PATH="/usr/local/bin:/usr/bin:/bin" pe() { for _i;do printf "%s" "$_i";done; printf "\n"; } pl() { pe;pe "-----" ;pe "$*"; } db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; } db() { : ; } C=$HOME/bin/context && [ -f $C ] && $C g++ FILE=${1-tut1.cpp} pl " Input data file $FILE:" cat $FILE # Create a small sample file. pe hi > sample.txt pl " Results, using one of the many libraries in /usr/lib/boost:" g++ $FILE -l boost_filesystem ./a.out sample.txt exit 0
The difficult part was finding the correct library for the compile and link.Code:$ ./s1 Environment: LC_ALL = C, LANG = C (Versions displayed with local utility "version") OS, ker|rel, machine: Linux, 2.6.32-71.29.1.el6.i686, i686 Distribution : CentOS Linux release 6.0 (Final) GNU bash 4.1.2 g++ (GCC) 4.4.4 20100726 (Red Hat 4.4.4-13) ----- Input data file tut1.cpp: // filesystem tut1.cpp ---------------------------------------------------------------// // Copyright Beman Dawes 2009 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; int main(int argc, char* argv[]) { if (argc < 2) { std::cout << "Usage: tut1 path\n"; return 1; } std::cout << argv[1] << " " << file_size(argv[1]) << '\n'; return 0; } ----- Results, using one of the many libraries in /usr/lib/boost: sample.txt 3
Best wishes ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote