• How to compile and use boost
    6 replies, posted
...And other C++ libraries in general. I don't want to just follow a step by step tutorial, I want to be able to understand how all that stuff works and what does each step do. I know you usually have to compile the library, and set up some paths and whatnot. Or is the install process specific for each library? Could someone explain each of these steps and why they are necessary? You can use boost as an example since that's what I'm currently trying to install. Again I'm not asking for a simple step by step tutorial any retard could follow, I actually want to learn how this stuff works. I'm using Code::Blocks with the MinGW compiler.
Boost has its own build system. You're not going to get a lot off it, although I'm currently editing this post to make it more useful. Libraries work in two ways. In one case, portions of the code is copied wholesale into your final program when compiling. This is called statically linking (because this process happens during linking) and requires the library to be only present when compiling . The other case, dynamically linking, requires some work when your program is run - when compiling, the linker notes what is required and notes it down in the binary. When running what is required will be loaded into memory - requiring you to always have the library on hand. Here's the theory, and now here's the [url=http://crasseux.com/books/ctutorial/Building-a-library.html]GCC manual[/url] on the specific "how". It is best they are both divorced because the details - the paths libraries can be in and so forth and how to include them by your compilers - differ.
-snip-
As for Boost, most of it is header-only. It's a simple matter of adding the including directory to your favorite IDE's project settings. If you need a must-be-compiled library, Bjam makes compiling it so trivial a child could do it. You just tell it the toolset and what libraries you want to build, and it does it automagically. After that, HubmaN's post is a good explanation of what you need to do.
Boost? [code] #include <boost/asio.h> [/code] and similarly should do it for most of the stuff in Boost. That's all you need. The entire library is manifest in the code in the header files, and by #including them, you are effectively just tacking on all the code and functions that are in the library to the top of your own code. Nothing fancy. But I'm sure you want to know how compiled libraries work too. Libraries are files with executable machine code with linking symbols in there. When using a compiled library in your project, all you have to do is #include the header with the function and class declarations in it. Your compiler doesn't have to do anything with the library, it just has to link references to the library functions with your code. This typically makes using compiled libraries faster than header libraries like boost. (faster in compile-time, that is.)
[QUOTE=Cathbadh;19303450]Boost? [code] #include <boost/asio.h> [/code] [/QUOTE] Not trying to be an ass, but its .hpp not .h .
BoostPro has precompiled libraries. Unfortunately, they're only for MSVC.
Sorry, you need to Log In to post a reply to this thread.