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:
- 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:
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 John@JohnMuellerBooks.com. 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 .