C++ Library on Ubuntu 14.04 – How to Install and Use Libraries

14.04clibraries

I'm trying to make this pokerstove library to work so it could be included and used in a simple .cpp file opened by simple text editor and compiled in terminal using

g++ -o my_prog my_cpp.cpp

Instruction tells that I need the following installed on my platform of choice:

  • boost, version 1.46 or higher
  • cmake, version 2.4 or higher
  • subversion, version 1.7 or higher

I did it using

sudo apt-get install libboost-all-dev cmake subversion

Also installed GNU C++ compiler like this

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
gcc -v
make -v

and git using

sudo apt-get install git

When i runed all the commands i was at my home folder (it's probably important)

girts@girts-ThinkPad-E520:~$ 

So far so good


Next i followed instructions

To build under linux using cmake, create a build directory, invoke
cmake on the programs directory, then build.
So again from the same directory i runed all the commands

git clone https://github.com/andrewprock/pokerstove.git
mkdir pokerstove/src/build
cd pokerstove/src/build
cmake ..
make

Next the creator of the library says

You should then be able to execute the simple command line example:

~/cmake/programs$ ./programs/ps-eval/ps-eval

So i runed it from here like this

girts@girts-ThinkPad-E520:~/pokerstove/src/build$ ~/cmake/programs$ ./programs/ps-eval/ps-eval

After it I got this error that there is no such directory which there isn't but is there anything I actually did wrong?

bash: /home/girts/cmake/programs$: No such file or directory

I tested out if those boost libraries were working with a simple code and everything were working fine. Anyway in the end i should be able to for example include there lines in my .cpp file

#include <iostream>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/math/special_functions/binomial.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <pokerstove/util/combinations.h>
#include <pokerstove/peval/Card.h>

As you can see this part is very interesting <pokerstove/peval/Card.h>

Would really appreciate if you guys would help me get it working. Maybe i somehow have to install everything in different place?

Best Answer

This is ok:

git clone https://github.com/andrewprock/pokerstove.git
mkdir pokerstove/src/build
cd pokerstove/src/build
cmake ..
make

After that, the binaries will be in:

~/pokerstove/src/build/bin

Run the binary with:

~/pokerstove/src/build/bin/ps-eval