11

I'm not extremely familiar with the linux filesystem, having moved from windows, but I do have a decent amount of experience with C++ and the Boost libraries in windows. Having switched Fedora 17, can anyone tell me if there is a certain directory where I should install Boost to get it working the gnu compiler?

Note: if it matters, I don't use an IDE I use vim for most of my programming.

2
  • 1
    anywhere as long as it's in the gcc include path. Commented Oct 14, 2012 at 4:51
  • Its better if you install it from GUI software repos in Fedora 17. Commented Oct 14, 2012 at 4:53

4 Answers 4

16

There are a few ways of setting up the boost libraries on linux.

  1. Save yourself some pain, use your package manager to install the Boost libs. You'll be grateful in the long run.

  2. If you absolutely must do it yourself, simply put it anywhere so long as it's in the gcc include path. This is /usr/local/include/ or /usr/include/ for headers and /usr/local/lib/ or /usr/lib/ for libraries

  3. Finally if for some reason that isn't possible, use the -I switch with g++ to specify the path to boost. (but this would only be necessary if 1 and 2 aren't possible)

Sign up to request clarification or add additional context in comments.

6 Comments

Can you elaborate on 1) please ?
Which linux distro are you running?
then you can do something like sudo apt-get install boost done :)
Oh -- mostly that you get updates for free and there's mutch less of a chance of you screwing up a build. Plus little to no path config
For the next person who winds up here: right now, the apt-get package is libboost-all-dev ( re: @jozefg's comment ). see also here.
|
14

Use your package manager to install boost libraries, for debian ubuntu it is like:

sudo aptitude install libboost-system1.49.0-dev 

for centos6 it is

yum install boost-devel 

2 Comments

Doesn't answer the question of where to put the files when the package manager is not a viable option.
@User1291 yes, because if you want to answer this, you need to know much more about environment user has. This is why distros exists/
2

I had issues installing boost using yum (recently installed Fedora 17).. so I unzipped the boost tar ball to my /opt.

so g++ -I /opt/boost/boost_1_51_0 works like a charm.

2 Comments

Did you adjust your PATH? If so, what did you add?
@Vérace no path adjustment required. Notice I'm passing the complete path to g++.
0

From the introduction to boost:

http://www.boost.org/doc/libs/1_51_0/more/getting_started/unix-variants.html

you can put it anywhere you like. And then you compile with something like this

c++ -I path/to/boost_1_51_0 example.cpp -o example \ -L~/boost/stage/lib/ -lboost_regex-gcc34-mt-d-1_36 

"c++" can be g++ or clang++ for example.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.