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.
I can't seem to find anything on the internet which show you how to build and compile a C++ library such that it can be used in R via the Rcpp package. I am missing some steps where the library is somehow linked to R tools
For instance how do you get the boost library working with R or any other such library?
Normal instructions:
https://andres.jaimes.net/718/how-to-install-the-c-boost-libraries-on-windows/
https://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html#or-build-from-the-command-prompt
This is almost surely a duplicate but I am in-between tasks and cannot search now...
"It's still complicated" but Rcpp 1.0.5 now also ship this arXiv paper I wrote on this as this vignette. In short, you need to differentiate between
header-only you can ship or include
small-ish library you include and build
an external library
The third one is hardest as you now have the problem of getting it to CRAN and your users.
I have the following files which I currently just want to manage to compile successfully. I have looked for a tutorial on how to use Poco, but unfortunately I couldn't find one for a complete beginner (I tried to follow the docs both under linux & eclipse, and win & vs08.)
I would very much appreciate if someone could guide me through the correct use of the Poco library (either under eclipse or vs08.)
edit: found the problem, i didn't specify to the linker the exact libraries, only their search paths.
You could look into how to use the POCO C++ as a static library in eclipse, then you first need to go through the process of building POCO for your architecture using make and the configure script included in the POCO C++.
Next you should be able to find some tutorials on how to include static libraries (and headers) in eclipse VS.
There are plenty of sources on the internet. For example their forum and this example
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.
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.