Using Boost 1.48.0 with CodeBlocks 10.05

Whenever you work with the material in C++ All-In-One Desk Reference For Dummies it’s always best to use the version of the software that the book is written to use. For the current version of the book, that means using CodeBlocks 8.02 and Boost 1.39.0. However, some readers really do want to use the most current version of the software and I can understand why they’d want to do so. That’s why I wrote a series of posts discussing the use of CodeBlocks 10.05:

 

 

Part 8 of this series of posts says that I’ve tested the book’s code with a combination of CodeBlocks 10.05 and Boost 1.47.0. Since that time, the makers of Boost have come out with another version of the product and a few readers have questioned me about it. I’ve verified that the compiler does in fact work with Boost 1.48.0 as well. So, you can use CodeBlocks 10.05 and Boost 1.48.0 together.

That said, some of the procedures found in the book for performing tasks such as building the tools are unlikely to work without modification. For example, on page 679 I tell you how to build Boost Jam. This tool no longer exists in 1.48.0, so naturally that directory is missing and the procedure won’t work. If you plan to use Boost 1.48.0, you’ll need to modify the procedures in the book to match your setup. I’ll rewrite these procedures to work with the latest version of the software during the next book update.

There is one important change you need to know about in order to successfully build the applications using Boost 1.48.0. Look on page 693 and you see a procedure for adding the Boost directory to the search directories list. You must change the directory to match the installation directory for Boost 1.48.0. The book assumes you’re using Boost 1.39.0 and uses that directory in the procedure. Other than this change, the example should work just fine.

If anyone does run across a problem using Boost 1.48.0, I’d love to know about it. Please contact me at John@JohnMuellerBooks.com with details about the problem you’re having and I’ll do my best to solve it.

 

Using CodeBlocks 10.05 – Part 8

This should be the next to the last post in this long running series. In the previous post, Using CodeBlocks 10.05 – Part 7, I was able to cover up to the end of Book V of C++ All-In-One Desk Reference For Dummies. This post begins with Book VI Chapter 1. I’m hoping to wrap up the coding differences for CodeBlocks 10.05 in the next post. You can find a complete list of these posts in the C++ All-in-One for Dummies category archive.

On page 638, you’ll find an example of the Functors category of the standard library. Likewise, on page 649 you find an example for working with temporary buffers. Neither example will compile in CodeBlocks 10.05 until you add another #include:

#include <algorithm>

On page 640, you’ll find a hash example. It compiles just fine, but you’ll receive this rather ominous sounding warning:

 

#warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.


It’s safe to ignore the warning for this edition of the book. In fact, you may see a number of these warningsall of which are safe to ignore for the time being. The example will run as before. The purpose of the warning it to tell you that a code update is necessary to keep pace with changes to the C++ libraries. I’ll be updating the code to use newer headers in the next edition of the book.

On page 641, you’ll find the hash map example, which won’t compile in CodeBlocks 10.05. This example requires the addition of another #include statement:

#include <string.h>

On page 647, you’ll find an example for using the random number generator. This example requires that you add the following two #include statements:

#include <time.h>
#include <stdlib.h>

On page 663, you’ll find an example for performing template specialization. You’ll need to add the following #include for this example:

#include <limits>

I tried the Boost examples in Book VI Chapters 3 and 4 using the latest version as of this writing (version 1.47.0). It appears to work fine with CodeBlocks 10.05 and the source code in the book. However, I’d like to hear about any problems that anyone has encountered using it.

If you encounter any other problems with Book VI, please be sure to let me know. In the next post I’ll start
with Book VII Chapter 1. In the meantime, keep those e-mails coming to John@JohnMuellerBooks.com.