Installing Boost numeric bindings - c++

Is the latest version of Boost numeric bindings in here:
http://svn.boost.org/svn/boost/sandbox/numeric_bindings/ ?
Are these only header files? So I don't need to compile and "install" it as such, just include from my programmes?
Also, where can I find examples or tutorial of how these should be used?

Is the latest version of Boost numeric bindings in here: http://svn.boost.org/svn/boost/sandbox/numeric_bindings/ ?
I hope so, at least it was the latest version before boost switched from svn to git. David Bellot should know, he can be reached via http://lists.boost.org/mailman/listinfo.cgi/ublas.
Are these only header files? So I don't need to compile and "install" it as such, just include from my programmes?
Yes and no. The bindings are only header files, but you still need to link your program against lapack (or blas, atlas, umfpack, mumps).
Also, where can I find examples or tutorial of how these should be used?
Some documentation can be found at http://svn.boost.org/svn/boost/sandbox/numeric_bindings/libs/numeric/bindings/doc/html/index.html
Some examples can be found at http://svn.boost.org/svn/boost/sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/
In general, the people at http://lists.boost.org/mailman/listinfo.cgi/ublas seem to be helpful, if you try to use the bindings (or ublas) and run into problems. But I'm not sure if any of them checks here at stackoverflow for potential users that ran into problems.

Related

Find the correct version of libraries

I'm trying to do a static build for an open-source project and I'm getting lots of errors while I try to build it.
How do I find the correct version of a library that the project is using?
I also tried to read the Makefile but I couldn't understand much from it. So is there any workaround or anything like that which makes the work easier?
AFAIK there is no way to find it out. It's not just the version. Many libraries can be built with different flags. You have to know the supported versions and necessary flags. For this purpose package managers were invented. Each package has meta information describing the dependencies.
Someone wrote a code using a library. If you want to use the code you have to use a compatible library. You can't find it out from the code. You can ask the developer, read the documentation or look into the package description. If you can't find a documentation of the dependencies you can try different versions and flags. This can cause crashes, undefined behavior or it works if you're lucky and you found a compatible version.

GMP - Certain Functions not declared, others are? C++/MinGW

In windows 'm building a C++ project that I have working in Linux that uses the GMP library. I am using the precompiled static MinGW library and include files from here - http://cs.nyu.edu/~exact/core/gmp/index.html
Everything seems to go well (mpz_init, mpz_mul, etc.) except when I get to mpz_powm_sec().
mpz_powm_sec(m, c, d, n);
That line gives:
error: 'mpz_powm_sec' was not declared in this scope
Yet none of my other references to GMP do. Does anyone know why this is happening and what I can do to make it compile?
The official website for GMP is https://gmplib.org/. The version you downloaded from that third-party website is more than 12 years old, the library has evolved quite a bit since then.
Notwithstanding the official GMP website at https://gmplib.org, the canonical source for precompiled binaries for use with MinGW.org's compiler tool chain is the SourceForge repository at https://sourceforge.net/projects/mingw/files/; the latest MinGW build of GMP is https://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.1.2/, (you will need the "-dev" package, for headers and import libraries, and likely the "-dll" for runtime bindings).
If you use binaries which have been prepared by the MinGW developers themselves, they will have been tested in conjunction with MinGW; if you grab third party builds, they may well be out of date, may not work, and you're pretty much on your own.

Is there any way to extract Boost Regex so I can package it with my project?

I'm working on a project written in C++ that uses the Boost Regex library to do some parsing. My problem is, I need to run the program on a remote machine that doesn't have the boost library installed. I also don't have admin access to this computer so I can't just install it myself.
Is there any way to separate out just the Boost Regex library so that I can put it in the same directory as my other code? I tried doing this already by downloading the boost library and separating out all of the unneeded headers and such. I managed to get it to a point where it calmost compiled but it failed at the linking stage.
Is there anything I can do to fix this or will I be forced to rewrite the parsing code?
You can use the Boost.BCP tool to extract a subset of Boost.
include the static library libboost_regex-gcc-1_35.a your list of object files to compile.
1_35 is an older version number on my linux box, you may have a newer library

boost library..........pre-built variants?

im just installing the boost library using an installer.
Its asking me which variants (about 8 options, 6 multithreaded and 2 single threaded) do i want to install. Im only installing this to get to grips and have a practice with boost, so im unsure?
Also, how do i use the libraries from VS02010 once ive 'installed' them using the installer?
thank you in advance
Boost documentation is your friend. A read of the information on getting started on Windows would save you much time.
Most of the libraries are header-only. You can use these just by including the correct headers as described in the individual library docs. If you want to use any of the ones that are not, you are going to need either to build your own libraries, or install the ones that come prebuilt. This is what your question pertains to. So you really must answer your own question - what is your target platform, and do you have to support multi-threaded programming? if in doubt, install them all and use the ones you need on a case-by-case basis.
To use the Boost libs once you have installed or built them, just include the relevant library in your project Linker options as for any other static library.

Using Boost on ubuntu

I've heard a lot of good comments about Boost in the past and thought I would give it a try. So I downloaded all the required packages from the package manager in Ubuntu 9.04. Now I'm having trouble finding out how to actually use the darn libraries.
Does anyone know of a good tutorial on Boost that goes all the way from Hello World to Advanced Topics, and also covers how to compile programs using g++ on ubuntu?
Agreed; the boost website has good tutorials for the most part, broken down by sub-library.
As for compiling, a good 80% of the library implementation is defined in the header files, making compiling trivial. for example, if you wanted to use shared_ptr's, you'd just add
#include <boost/shared_ptr.hpp>
and compile as you normally would. No need to add library paths to your g++ command, or specify -llibboost. As long as the boost directory is in your include path, you're all set.
From the boost documentation:
The only libraries that need to be compiled and linked are the following:The only Boost libraries that must be built separately are:
Boost.Filesystem
Boost.IOStreams
Boost.ProgramOptions
Boost.Python (see the Boost.Python build documentation before building and installing it)
Boost.Regex
Boost.Serialization
Boost.Signals
Boost.Thread
Boost.Wave
A few libraries have optional separately-compiled binaries:
Boost.DateTime has a binary component that is only needed if you're using its to_string/from_string or serialization features, or if you're targeting Visual C++ 6.x or Borland.
Boost.Graph also has a binary component that is only needed if you intend to parse GraphViz files.
Boost.Test can be used in “header-only” or “separately compiled” mode, although separate compilation is recommended for serious use.
So, if you're using one of the listed libraries, use the Getting Started guide to, well, get you started on compiling and linking to Boost.
The Boost website has some good tutorials, they are just kind of hidden.
The library documentation is a mixed bag. Some is good, but some is more of a reference than a guide. The best guide to (some of) the Boost libraries is the book Beyond the C++ Standard Library. At the very least, the introduction gives one paragraph descriptions of many of the libraries. From there, you can decide which library is most important for your current needs, and, if it's in the book, read the chapter on it, or read the documentation on the website.
If you read German, there's a good online guide. Google translate does a good enough job that a non-speaker like me can understand it.
Also, unless you have lots of experience with C++, I'd start with the simpler libraries (e.g. smart_ptr, tuple, conversion, tokenizer, regex, date_time, test), before trying the more complicated ones (bind, variant, any), or the really advanced ones (concepts, MPL, Fusion).
Using Easypeasy 1.1 (for netbooks) which is based upon Ubuntu I was able to use Synaptic Package Manager to install, I believe, libboost-dev. Then simply by adding:
#include "boost/foreach.hpp"
I was able to replace the existing lines in an existing application (which has an Ask class which has nothing to do with boost):
for (std::vector<Ask*>::iterator ii=ui.begin(); ii!=ui.end(); ++ii)
std::cout << (*ii)->prompt() << (*ii)->answer() << std::endl;
with:
BOOST_FOREACH (Ask* ii, ui)
std::cout << ii->prompt() << ii->answer() << std::endl;
As I understand it this is a header only feature. I have not used anything requiring link time changes yet.
I was just looking at that german boost guide, and found there was an english one as well (same book). It looks pretty good, have just read the introductory pages which are quite useful
The best tutorial I've read so far are those two books:
Introduction to the Boost C++ Libraries; Volume I - Foundations
Introduction to the Boost C++ Libraries; Volume II - Advanced Libraries
The libraries come with documentation and many of them have tutorials as part of the documentation. Just start reading.
Boost is not a programming language nor an application framework - because it's just a collection of libraries, there is no such thing as a Boost 'Hello World' program. Most libraries in Boost can be used more or less independently, and they vary in size from one function to massive libraries that could stand alone.
The best way to get to know Boost is simply to try and work it in as you write new code. Use smart_ptr whenever you can; use the MPL next time you want to do compile-time work. There's a lot of variety in Boost, but you should probably start looking at the Utility section; those are the lightest-weight and most commonly-used libraries.