I'm sorta new to C++ and I've decided to try and use odeint
to do some simulations because python is too slow for my needs.
I found this package, which I want to play with. I'm just not totally sure how to install or where to place these libraries. Is there something for C++
similar to python's pip install
?
Side note: I'm trying to do this using Eclipse Kepler
, but I'm not married to that idea.
I recommend not putting the code into your own project - that is a rather quick and dirty solution. The correct way to use a library in C++ (in fact, in any programming language that I know) is to keep all libraries separate from your own projects, at a separate location on your filesystem.
You then tell your environment where to find the library files and tell your project to use them. It's always the same basic idea, whether you are using Makefiles or Visual Studio project files.
Look at the documentation of this library. It says:
odeint is a header-only library, no linking against pre-compiled code is required
This means that the "library files" I just mentioned are just header files. That makes it much easier for you, because you don't have to deal with linker options. In C++, the location where additional (project-external) header files can be found is usually called the "include path".
Your new problem should therefore be: How to tell Eclipse Kepler my include path?
Entering this new problem into Google (as "eclipse kepler include path") yields a few interesting results. It will eventually lead you to the Eclipse documentation about include paths, where you can learn how to edit the C++ include path.
Now that everything is set up, you can finally use the library's header files in your projects via lines like the following:
#include <boost/numeric/odeint.hpp>
Do you notice the < >
? They make a big difference, because they are the C++ way of saying "this is not part of my project, please get it from my include path". Just like headers which are part of the language (e.g. <vector>
or <iostream>
).
All of this may appear troublesome at first, and perhaps you even gain little from it at the beginning, but in the long run, for many different projects and many different libraries, it's the only way to prevent chaos.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With