One of the most common e-mails I receive about C++ All-In-One Desk Reference For Dummies is that people are receiving an error message about the compiler when they try to compile the examples. A common error message is:
SayHello2 – Debug uses an invalid compiler. Probably the toolchain path within the compiler options is not set up correctly?! Skipping … Nothing to be done.
The reason you’re having trouble is due to an error on the CD. It turns out that our production folks made a mistake in putting the book’s CD together. The product that we have on the CD is the IDE only and does not include the compiler. There is a quick solution to the problem should you wish to use it:
- Go to this page: http://www.codeblocks.org/downloads/5.
- Download the second item on the list, codeblocks-8.02mingw-setup.exe. That contains the compiler.
- Double click the file once the download is complete and follow the instructions to install the compiler.
If you’re using Windows Vista or Windows 7, the version of the MinGW compiler that comes with CodeBlocks might not work. (It does work on my copy of 64-bit Windows 7 and many other people have used it successfully, but a few people do run into problems.) In this case, you’ll need to go to http://www.mingw.org/ to download the latest version of the MinGW compiler as they suggest on the CodeBlocks Web site. You can also get the latest version of the compiler from http://sourceforge.net/projects/mingw/files/Automated MinGW Installer/. My writing partner, Jeff, suggests that you install:
- g++ compiler
- MinGW Make
into C:\MinGW to make the compiler easier for CodeBlocks to find. At this point, start the CodeBlocks compiler. Once it has started up, select Settings -> Compiler and Debugger. In the Compiler and Debugger Settings dialog box, click the “Selected Compiler” dropdown and choose the GNU GCC Compiler option. You should be good to go at this point. Please let me know if you experience any other problems at John@JohnMuellerBooks.com.
I remember the discussion well; my wife and I were on a short vacation in the mountains of California one day (Julian for those of you who know the little town in Southern California) and we were talking about gardening. It sounds like a topic that is a long way from self-sufficiency or health, but there is a connection; even we didn’t know it at the time though. That discussion happened over 15 years ago. Today, we’re living a different sort of reality, much of it stemming from that innocuous discussion.
At the time, I weighed in at a gargantuan 365 pounds (perhaps a little more) and had a 54 inch waist. It was hard to find time to exercise and even harder to find money for a gym membership. Exercise consisted of walks, when time allowed. Today, I’m much lighter, having lost 127 pounds (so far) and my 42 inch waist is much smaller. My blood pressure has gone way down, my heart rate as well. In addition, I take far less medication today than I did at one time and my diabetes is under control. The technique I’ve used has also naturally decreased my LDL cholesterol and increased my HDL cholesterol. The entire process has required a little over 12 years to complete; a long time granted, but the process has been slow and continuous.
You might wonder how much it cost to lose that much weight. That’s the interesting part. My wife and I now grow about 95% of our own food. We eat higher quality and fresher food and spend a whole lot less money in the store. In short, instead of paying for a gym membership, we exercise and earn money (in the form of store and medication savings) while doing it. You won’t find that sort of deal anywhere on TV.
The interesting thing about the approach I’ve taken is that my weight loss has been slow and continuous. The exercise I get by producing the things I need has actually increased my stamina and strength, while reducing my weight. I never get bored exercising this way because each day brings something new. One day I’m stretching while picking weeds in the garden, another day I’m lifting bushel baskets full of produce. Each day brings something new and the tasks I perform change by season. There is no falling off the cart because the change I’ve made is a part of my lifestyle now; I wouldn’t consider living any other way.
This entry has been short, but I wanted to introduce you to the idea behind self-sufficiency. It’s a method of producing what you need, gaining some substantial health benefits, and making money while you’re doing it. No, you won’t get a pile of cash from your garden, but wouldn’t you like to spend less at the store? What would you do with the money you save by reducing the groceries you buy in half? That’s what self-sufficiency is about; it’s about doing for yourself.
Keep your eyes peeled for additional posts in this category as I have time to write them. In the meantime, I’d like to hear your thoughts about self-sufficiency. Write me at John@JohnMuellerBooks.com.
64-bit processors have been around for a long time now. Unlike the move to 32-bit processors, the move to 64-bit processors has been sluggish. In fact, if the move goes any slower, we’ll still be using 32-bit processors ten years (or more) from now. The main reason that the move to 64-bit processors has been so incredibly slow is that users are basically happy with their 32-bit setups. There isn’t any compelling application that makes the move to a 64-bit environment necessary, or even desirable. So, we still have 32-bit Windows XP enjoying a huge market share. It wasn’t until October 2010 that its market share finally fell below 60 percent.
However, the environment is beginning to change for a number of reasons. For one thing, Windows XP is becoming less secure as Microsoft starts to view it as an old OS past its prime. Yes, you still get security updates for Windows XP, but it’s only a matter of time before those updates become ineffective; the platform is simply becoming outdated and hard to maintain.
Anyone who has worked with Vista knows that the platform has problems. In fact, I tried my best not to work with it unless absolutely necessary. Windows 7 is a different story. I’ve been using it now for quite a few months without any problems at all. In fact, except for a few problem applications, I don’t even notice the Windows 7 differences any longer; it has become part of the background for me, as it has become part of the background for many people.
Windows 7 works best as a 64-bit operating system. I tried it as a 32-bit operating system and found that it lacked pep. A memory upgrade and moving to Windows 7 64-bit have made all the difference in the world. I now consider Windows 7 a true upgrade to Windows XP and hope that people begin moving to it en masse soon.
Microsoft has also made the move to 64-bits in some of the server products it offers. For example, Microsoft Exchange comes only as a 64-bit product now, as does SharePoint. Consequently, many organizations are beginning the arduous upgrade to 64-bit operating systems on their servers.
Using a 64-bit setup does have significant advantages. Of course, there is the availability of additional memory to consider. It’s also possible to perform certain code optimizations on a 64-bit system that you can’t achieve using 32-bits. Of course, if you want to obtain the full benefits of a 64-bit platform, you need 64-bit applications. Some developers are worried about the consequences of this move and for good reason. Making the move to the 64-bit environment is fraught with unexpected pitfalls. My latest article, “10 Biggest Issues for Developers Migrating 32-bit Applications to 64-bits”, explains some of the most common problems that developers encounter when moving their applications to the 64-bit environment. Give it a read and let me know what you think at John@JohnMuellerBooks.com.
Regular expressions are a powerful feature of the FindStr utility. However, they can also prove frustrating to use in some cases because the documentation Microsoft provides is lacking in good examples and difficult to follow. You can see some usage instructions for FindStr starting on page 82 of the Windows Command-Line Administration Instant Reference .
A reader recently commented that there is a problem with the dollar sign ($) regular expression. It must actually appear after the search term to be useful. Of course, the problem is creating a test file to sufficiently check the use of the regular expressions, so I came up with this test file:
Now, let’s perform some tests with it. Here is the result of some tests
that I performed using this test file and FindStr regular expressions:
The first test case shows what happens when you try
the command on page 82 of the book. It appears to work, but you’ll see
in a moment that it actually doesn’t. Let’s take the two parts of the
regular expression apart. Using FindStr “^Hello” *.TXT seems to work just fine. However, the command FindStr “$World” *.TXT doesn’t produce any output.
Only when the $ appears after World does the command produce an
output. Consequently, page 82 should show the rather counterintuitive
command, FindStr “^Hello World$” *.TXT to produce the correct output.
It’s also important to be careful about making generalizations when
using FindStr. For example, when working with the test file originally
shown in this example, the FindStr /B /C:”Hello World” *.TXT command produces the same output as FindStr “^Hello” *.TXT as shown here:
If you change the test file like this though:
you’ll see these results:
As you can see, you must exercise care when using FindStr to obtain the
desired results. What other odd things have you noticed when using
regular expressions with FindStr? Add a comment here or write me at John@JohnMuellerBooks.com to let me know.
At least some readers try to hand type the source code found in C++ All-In-One Desk Reference For Dummies. Working with source code when you’re learning a new programming language is hard enough; typing it in by hand and getting a good result is nearly impossible in many cases. I recommend that you always use the code from the book’s CD so that you can avoid potential typos. If you experience problems using the code from the book’s CD, please query me at John@JohnMuellerBooks.com; there may be something that isn’t set up correctly on your system. The examples on the CD should compile and work, but I always emphasize the word “should”
because each system and setup is slightly different (making things exciting for all of us).
To use the code on the CD, follow these steps:
- Copy the Author folder from the CD to your hard drive.
- Right click the Author folder and choose Properties from the
context menu. You’ll see the Author Properties dialog box.
- Clear the Read-only check box. Click OK. You’ll see a Confirm
Attribute Changes dialog box.
- Click OK. Windows will remove the read-only attribute from all
of the files. You’re ready to begin using the source code supplied with the
To use a particular example, navigate to that examples folder under the Author folder. Say you want to work with the AddInteger example in Book I Chapter 2. You’d navigate to the \Author\BookI\Chapter02\AddInteger. To open the project, simply double click the associated .CBP file. In this case, you’d double click the AddInteger.cbp file and CodeBlocks will open with the example loaded and ready for you to work with.
I’ve been thinking about something for quite a while now. For me, there is nothing better than sitting by my wood stove, coffee cup next to me, reading a favorite book. Of course, I’m talking about a hard cover or paperback book. Nothing quite matches the feel and smell of paper, especially when you’re reading a book for leisure. The hours I’ve spent reading books have been pleasurable to the extreme. I’m transported to worlds of mystery in some cases, worlds of the future in others. Fantasy, science fiction, techno-thriller; they all hold a certain thrill.
It’s a different matter when I start working with technical material. As you might imagine, I’ve collected quite a few technical books in 23 years. In fact, I’ve discarded quite a few books during that time; a mountain of technical knowledge that no longer seems important to anyone but a historian. That is, until I figure out that I discarded the one antique I really did need for a particular project. Suddenly I’m looking somewhere, anywhere, for that book. Even when I know where the book resides and I peruse its well thumbed pages by instinct, finding just the right information can prove difficult.
Unfortunately, no book cataloging system in the world will solve my problem. I could catalog each of my hundreds of books and still not find the information I actually need with any speed. Of course, the ability search quickly is one of the benefits of electronic storage. If I had my books in electronic format, I might avoid the hours upon hours of search time for that one piece of information I actually need. Then again, I’ve accidentally found many pieces of useful subsidiary information during such searches, so it’s not possible to discount paper as unworthy. Still, speed is of the essence while I’m working on my next project.
For now, it appears that my future will rely on two media for books: paper for leisure and electronic for work related materials. It’s a sad thing for me to admit, but the paper book has become a bit too cumbersome for a world where speed is prized above all. What about you? What do you feel about e-books?