|
|
---
|
|
|
layout: post
|
|
|
title: Test Boost
|
|
|
subtitle: minimal working example
|
|
|
permalink: 2016-11-04-boost.html
|
|
|
---
|
|
|
|
|
|
|
|
|
One of `JuPedSim`'s [requirements](2016-11-03-Requirements.html) is Boost.
|
|
|
|
|
|
In order to make sure that this library is properly installed, this *minimal working* example can be very handy.
|
|
|
|
|
|
```c++
|
|
|
#include <boost/geometry.hpp>
|
|
|
#include <boost/geometry/geometries/point_xy.hpp>
|
|
|
#include <boost/geometry/geometries/polygon.hpp>
|
|
|
#include <iostream>
|
|
|
|
|
|
using namespace boost::geometry;
|
|
|
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
std::cout << "Using Boost "
|
|
|
<< BOOST_VERSION / 100000 << "." // major version
|
|
|
<< BOOST_VERSION / 100 % 1000 << "." // minor version
|
|
|
<< BOOST_VERSION % 100 // patch level
|
|
|
<< std::endl;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Using the following [CMakeLists.txt](https://cst.version.fz-juelich.de/jupedsim/jpscore/snippets/3)
|
|
|
the compilation of the aforementioned file goes like
|
|
|
|
|
|
```bash
|
|
|
cmake .
|
|
|
make
|
|
|
run ./main
|
|
|
```
|
|
|
|
|
|
It is also possible to compile the code directly without passing by `CMake`, however since it is used with `JuPedSim`, it is a
|
|
|
good idea to test it here too.
|
|
|
|
|
|
|
|
|
|