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

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.

Related

Using Boost Pre-build package

I want to use Boost.Thread library in a C++ software that I'm developing.
Since I'm a complete newbie in C++, I would like to know if there are any differences between:
Downloading and building Boost manually for MSVC9-x64
Using a pre-built package: http://boost.teeks99.com/
Option 1 seems so painful...
As far as I can tell, these are the default builds and not from patched or tweaked sources or anything.
If you take care to use the correct version of binaries for your application target and version of VC (including service packs) and link against the correct libraries (shared, static CRT, debug, etc.) you should be absolutely fine.
Also, since it seems that these packages don't contain Boost headers, you must take care to get and use the correct version of headers.
Concerning the "differences". Boost is a large and complex collection of libraries. For a software of that size, it has a quite simple and straightforward build process, but still, there are many options and customizations you can do when building Boost (e.g. you can build Boost.Iostreams with or without zlib and bzip2 support, build Boost.Regex with or without Unicode support, build Boost.Python against different versions of Python, and much more.) When you build Boost, you have control over these options.
The defaults work for most people, but some people may need certain customizations. You might want a specific version of a specific optional dependency, or a certain library built a certain way. For that, you probably will need to build Boost yourself and maintain the build throughout your project. This is not a scary task!
If you don't have any special requirements, then a generic build would most probably be fine for you.

How can I learn to include and link to libraries?

I'm trying to teach myself C++ programming. The C++ is the easy part. Some patience and good reference material goes a long way. Including and linking against libraries is the hard part. The instructions provided usually assume some knowledge which I don't have and don't know how to aquire without painfully slow trial and error.
The latest concrete example is http://cpp-netlib.org/
I've spent the whole afternoon trying to get it to work and I still don't even an idea why it's not working.
How can I learn this skill from the ground up?
Is it it normal to have such enormous difficulties learning how to do this?
Well, the principle is pretty much always the same for any C++ compiler (the option flags mentioned are quite standard but might differ for particular compilers):
Install a library you want to use in your system (this may include a step to compile this library with your particular compiler toolchain).
Setup the include paths to be used for this library using the -I option
Use the headers of the library API in your code (#include <libheader.h>)
Setup the library paths to be used for this library using the -L option, tell the linker which libraries to link using -l<extra>, where extra should refer to some file named lib<extra>.a or lib<extra>.lib
Things to note:
Third party libraries might depend on further libraries you'd also need to install (compile with the same toolchain as your target uses)
On Windows using the MS Visual Studio (Express) toolchain you'll need to take care choosing the right library versions that are compliant with the 'threading model' and in general 'debug' / 'non-debug' library versions.
An (appropriate and useful) IDE will usually let you choose the toolchain (MinGW GCC, MS VS compiler, LLVM, etc.) on project setup, and offer some properties dialog to set these options.
What's necessary to setup for the toolchain, 3rd party libraries, IDE and OS you're using is a bit different learning curve and depends on what you want to use in particular.

how to upgrade c++ builder 2010 boost libs

As far as I know ERS C++ Builder 2010 comes with Boost libraries. During installation it will also install Boost libraries.
As new libraries will be realeased or modified(optimized), it gets me to upgrade to the latest version.
So i'm asking can i do this by replacing boost directory?
It's not as simple as updating the $(CG_BOOST_ROOT) directory with a new boost.
See this question previously asked on SO.
Someone could put the effort in, and it could be possible to run many of the latest boost libraries with bcc. (and hopefully submit those changes back to boost) That hasn't really happened yet.
However, even with a Herculean effort there are some constructs used by boost that bcc just doesn't handle yet, so there will be some boost libraries that won't be usable by bcc.

find boost library path

I'm writing a program using boost program_options, I followed this instruction: http://www.boost.org/doc/libs/1_47_0/more/getting_started/unix-variants.html#build-a-simple-program-using-boost and everythings is fine. The point now is that I want to distribute the source, so my problem is how to find where the boost libraries are installed on other linux machines (supposing they are). For example on my pc they are in /usr/lib64 but on the other machine they're installed in non-standard places.
I don't want to use tool like autotools, I'm using a simple plain Makefile.
Is there some tool provided with the boost installation to find where the libraries are? Is there some enviroment variables?
You either need to use a tool like autotools (I thoroughly recommend CMake, it's awesome), or have it available in a place that your compiler can find it. You can't configure everyone's system for them though, so usually the latter is insufficient.

Move C++ app with Boost from Linux to Windows with Visual Studio 6

I made a small program with Boost in Linux 2 yrs ago. Now I want to make it work in Windows. I found there are few .a files in my libs folder. I am wondering how to make it works in Windows? do I need to build Boost in Windows to get library or I can download somewhere? I am using Visual Studio 6.
Yes, you'll need to recompile for different platforms. Coincidentally, I posted instructions on this not long ago.
I hugely recommend you do not use Visual Studio 6. It's very dated, and terribly non-conforming. You can get the newer versions for free, as Express. You won't be missing anything.
Many boost libraries are header-only, you don't need to link against anything to use them. Libraries such as boost::filesystem require you to build libs appropriate for your platform and link against them.
Precompiled boost for MSVC7,8,9 can be found here (in the hope that you follow GMan's advice and get rid of VS6 …)
.a files from Unix are like .lib files in Windows. They will not work, and there is no way of "converting" them, short of using a compiler on the original source code.
However, Boost does build on Windows. Just download it (or more likely, the closest version you can find to the one your code was using).
Older versions of Boost did work under VS6, but with a whole lot of stuff disabled (VS6 really just barely qualified as a C++ compiler). If you can, I highly suggest you use a newer version of Visual Studio.
You have a few options. Building Boost will give you the greatest flexibility in working with your application and boost libraries. However, you can download pre-built Boost libraries wrapped up in a nice windows installer here, Boost Packages
But one thing to keep in mind, depending on what you used in Boost, a lot of it is template based so no libraries are required. If you're only using some templatized portions, you don't need to worry about any of this. Just make sure you have boost in your include path when building.
As a side note, you can get free but limited versions of newer MS compilers here: http ://www.microsoft.com/exPress/