Using CodeBlocks 10.05 – Part 2

I started working with CodeBlocks 10.05 as a result of people asking how it would work with my book C++ All-In-One Desk Reference For Dummies. The first post, Using CodeBlocks 10.05 – Part 1, gets you started with the new version. I had mentioned in that post that I had started testing the book’s source code. As you might imagine, it takes a while to test all of the source code for a book that size.

Today I ran across my first problem. Several of the book’s examples:

  • BookIII\Chapter02\BuggyProgram\main.cpp
  • BookIII\Chapter03\Breakpoints2\main.cpp
  • BookIII\Chapter04\NestedCalls\main.cpp
  • BookIV\Chapter01\Array04\main.cpp
  • BookVII\Chapter01\Hello World\Hello World\Hello World.cpp

rely on a call to:


These examples compile just fine in CodeBlocks 8.02. Unfortunately, they won’t compile in CodeBlocks 10.05 and your only clue that there is a problem is the cryptic error message: ‘system’ was not declared in this scope. It turns out that there is a simple fix for this problem. All you need to do is add a simple statement at the beginning of the example:

#include <cstdlib>

This statement will fix the problem for you. Make sure you add it with all of the other #include statements at the beginning of the file. If you find any examples that fail to work, please be sure to let me know at I haven’t tested this fix for backward compatibility with CodeBlocks 8.02, but will try it at some point in the future (my focus for the moment is checking on CodeBlocks 10.05). If someone has trouble making the fix work with CodeBlocks 8.02, please let me know that as well .

Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 99 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John is also setting up a website at Feel free to take a look and make suggestions on how he can improve it.