Repository navigation
Closed
Labels
Description
This took me a long time to figure out, and I didn't know where else to dump this knowledge, so here goes.
Some of the information on the Installing C++ page is no longer applicable, at least to Ubuntu 16.04 LTS. I found rumblings and bits and pieces around the Internet, and filled in a bunch of gaps, and this is the result.
- Install Exercism per the Getting Started page.
- Install GCC and CMake as per the Installing C++ page.
- Install a package called
libboost-all-dev:
sudo apt-get install libboost-all-dev - Install Boost 1.59. Install exactly this version and not a later one as implied on the Installing C++ page as both earlier and later versions will not work with CMake 3.5.1. The Samuel Bachmann PPA mentioned on the Installing C++ page (and the associated commands) will not work for Xenial Xerus (16.04 LTS) because it was never updated to, so download the source from Boost's Download page for Boost 1.59.
- Extract the tar archive containing Boost 1.59
tar -xf boost_1_59_0.tar.gz
-- OR --
tar --bzip2 -xf boost_1_59_0.tar.bz2 - Move the extracted directory to
/usr/local:
sudo mv boost_1_59_0/ /usr/local/ - Open your shell config file; for example, if you're running Bash (the default in Ubuntu 16.04 LTS), you might open your
.bashrcfile in an editor like Text Editor:
gedit ~/.bashrc - Add these lines at the end of your config (still assuming Bash here) to let CMake know where your Boost installation is (though not sure if
$BOOST_LIBRARYDIRis necessary):
# Boost (for CMake and Exercism)
export BOOST_ROOT="/usr/local/boost_1_59_0"
export BOOST_LIBRARYDIR="$BOOST_ROOT/boost"
- Reload your shell config file (assuming Bash, yet again):
source ~/.bashrc - Navigate to your Boost directory:
cd $BOOST_ROOT - Run the
bootstrap.shscript:
./bootstrap.sh - Run the b2.sh script (my machine is old, but it took about 30 minutes to complete for me):
/.b2.sh - Assuming you have not already done so, navigate to the folder you're keeping Exercism's CPP exercises in and download the first exercise:
exercism download --exercise=hello-world --track=cpp - If you have not already done so, create the exercise's files as per the Running the Tests page.
- If you have not already done this, either, use CMake to create the Unix Makefiles (include the quotes):
cmake -G "Unix Makefiles"
If you already attempted this once, delete these files from your exercise's folder:
CMakeFiles/
cmake_insall.cmake
CMakeCache.txt
- Once you have completed the exercise and want to build, simply run the
makecommand:
make
There will be a lot of warnings, but if you did the exercise properly, the project will build successfully, and the output will end like this:
[ 66%] Building CXX object CMakeFiles/hello-world.dir/hello_world.cpp.o
[100%] Linking CXX executable hello-world
Running 1 test case...
*** No errors detected
[100%] Built target hello-world
I know lots of people were having issues with newer versions of Visual Studio and Windows 10, as well, so I hope this helps you at least find a direction to go in.
Activity
radix-r commentedon Aug 15, 2018
I think for your step 12 you need to run:
./b2 installAt least that is what I had to do on my machine.
arcuru commentedon Apr 20, 2019
We've removed our dependency on Boost, see #233. The setup now is much simpler. Closing this.