Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
C++ Application Development with Code::Blocks
C++ Application Development with Code::Blocks

C++ Application Development with Code::Blocks: Using Code::Blocks it's possible for C++ developers to create application consistency across multiple platforms. This book takes you through the process from installation to implementing advanced features, all with a user-friendly approach.

eBook
$22.99 $25.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

C++ Application Development with Code::Blocks

Chapter 1. Getting Started with Code::Blocks

While writing this book, Code::Blocks—12.11 was the latest stable release available. This release comes with GCC 4.7.1 compiler for Windows. We'll use this release for C++ development throughout this book. In this chapter, we'll download Code::Blocks, install and learn more about it.

Why Code::Blocks?


Before we go on learning more about Code::Blocks let us understand why we shall use Code::Blocks over other IDEs.

  • It is a cross-platform Integrated Development Environment (IDE). It supports Windows, Linux, and Mac operating system.

  • It supports GCC compiler and GNU debugger on all supported platforms completely.

  • It supports numerous other compilers to various degrees on multiple platforms.

  • It is scriptable and extendable. It comes with several plugins that extend its core functionality.

  • It is lightweight on resources and doesn't require a powerful computer to run it.

  • Finally, it is free and open source.

Installing Code::Blocks on Windows


Our primary focus of this book will be on Windows platform. However, we'll touch upon other platforms wherever possible. Official Code::Blocks binaries are available from www.codeblocks.org. Perform the following steps for successful installation of Code::Blocks:

  1. For installation on Windows platform download codeblocks-12.11mingw-setup.exe file from http://www.codeblocks.org/downloads/26 or from sourceforge mirror http://sourceforge.net/projects/codeblocks/files/Binaries/12.11/Windows/codeblocks-12.11mingw-setup.exe/download and save it in a folder.

  2. Double-click on this file and run it. You'll be presented with the following screen:

  3. As shown in the following screenshot click on the Next button to continue. License text will be presented. The Code::Blocks application is licensed under GNU GPLv3 and Code::Blocks SDK is licensed under GNU LGPLv3. You can learn more about these licenses at this URL—https://www.gnu.org/licenses/licenses.html.

  4. Click on I Agree to accept the License Agreement. The component selection page will be presented in the following screenshot:

  5. You may choose any of the following options:

    • Default install: This is the default installation option. This will install Code::Block's core components and core plugins.

    • Contrib Plugins: Plugins are small programs that extend Code::Block's functionality. Select this option to install plugins contributed by several other developers.

    • C::B Share Config: This utility can copy all/parts of configuration file.

    • MinGW Compiler Suite: This option will install GCC 4.7.1 for Windows.

  6. Select Full Installation and click on Next button to continue. As shown in the following screenshot installer will now prompt to select installation directory:

  7. You can install it to default installation directory. Otherwise choose Destination Folder and then click on the Install button. Installer will now proceed with installation.

  8. As shown in the following screenshot Code::Blocks will now prompt us to run it after the installation is completed:

  9. Click on the No button here and then click on the Next button. Installation will now be completed:

  10. Click on the Finish button to complete installation. A shortcut will be created on the desktop.

This completes our Code::Blocks installation on Windows.

Installing Code::Blocks on Linux


Code::Blocks runs numerous Linux distributions. In this section we'll learn about installation of Code::Blocks on CentOS linux. CentOS is a Linux distro based on Red Hat Enterprise Linux and is a freely available, enterprise grade Linux distribution. Perform the following steps to install Code::Blocks on Linux OS:

  1. Navigate to Settings | Administration | Add/Remove Software menu option. Enter wxGTK in the Search box and hit the Enter key. As of writing wxGTK-2.8.12 is the latest wxWidgets stable release available. Select it and click on the Apply button to install wxGTK package via the package manager, as shown in the following screenshot.

  2. Download packages for CentOS 6 from this URL—http://www.codeblocks.org/downloads/26.

    Unpack the .tar.bz2 file by issuing the following command in shell:

    tar xvjf codeblocks-12.11-1.el6.i686.tar.bz2
    
  3. Right-click on the codeblocks-12.11-1.el6.i686.rpm file as shown in the following screenshot and choose the Open with Package Installer option.

  4. The following window will be displayed. Click on the Install button to begin installation, as shown in the following screenshot:

  5. You may be asked to enter the root password if you are installing it from a user account. Enter the root password and click on the Authenticate button. Code::Blocks will now be installed.

  6. Repeat steps 4 to 6 to install other rpm files.

We have now learned to install Code::Blocks on the Windows and Linux platforms. We are now ready for C++ development. Before doing that we'll learn about the Code::Blocks user interface.

First run


On the Windows platform navigate to the Start | All Programs | CodeBlocks | CodeBlocks menu options to launch Code::Blocks. Alternatively you may double-click on the shortcut displayed on the desktop to launch Code::Blocks, as in the following screenshot:

On Linux navigate to Applications | Programming | Code::Blocks IDE menu options to run Code::Blocks. Please note that in subsequent chapters of this book we'll limit our discussion mostly to the Windows platform. However, usage of Code::Blocks and C++ development (excluding platform specific areas) remain the same over both platforms.

Code::Blocks will now ask the user to select the default compiler. Code::Blocks supports several compilers and hence, is able to detect the presence of other compilers. The following screenshot shows that Code::Blocks has detected GNU GCC Compiler (which was bundled with the installer and has been installed). Click on it to select and then click on Set as default button, as shown in the following screenshot:

Do not worry about the items highlighted in red in the previous screenshot. Red colored lines indicate Code::Blocks was unable to detect the presence of a particular compiler.

Finally, click on the OK button to continue with the loading of Code::Blocks. After the loading is complete the Code::Blocks window will be shown.

The following screenshot shows main window of Code::Blocks. Annotated portions highlight different User Interface (UI) components:

Now, let us understand more about different UI components:

  • Menu bar and toolbar: All Code::Blocks commands are available via menu bar. On the other hand toolbars provide quick access to commonly used commands.

  • Start page and code editors: Start page is the default page when Code::Blocks is launched. This contains some useful links and recent project and file history. Code editors are text containers to edit C++ (and other language) source files. These editors offer syntax highlighting—a feature that highlights keywords in different colors.

  • Management pane: This window shows all open files (including source files, project files, and workspace files). This pane is also used by other plugins to provide additional functionalities. In the preceding screenshot FileManager plugin is providing a Windows Explorer like facility and Code Completion plugin is providing details of currently open source files.

  • Log windows: Log messages from different tools, for example, compiler, debugger, document parser, and so on, are shown here. This component is also used by other plugins.

  • Status bar: This component shows various status information of Code::Blocks, for example, file path, file encoding, line numbers, and so on.

Introduction to important toolbars


Toolbars provide easier access to different functions of Code::Blocks. Amongst the several toolbars following ones are most important.

Main toolbar

The main toolbar holds core component commands. From left to right there are new file, open file, save, save all, undo, redo, cut, copy, paste, find, and replace buttons.

Compiler toolbar

The compiler toolbar holds commonly used compiler related commands. From left to right there are build, run, build and run, rebuild, stop build, build target buttons. Compilation of C++ source code is also called a build and this terminology will be used throughout the book.

Debugger toolbar

The debugger toolbar holds commonly used debugger related commands. From left to right there are debug/continue, run to cursor, next line, step into, step out, next instruction, step into instruction, break debugger, stop debugger, debugging windows, and various info buttons.

Summary


In this chapter we learnt to download and install Code::Blocks. We also learnt about different interface elements. In the next chapter we shall start coding in C++ with Code::Blocks.

Left arrow icon Right arrow icon

What you will learn

  • Install and configure Code::Blocks
  • Develop console-based C++ applications
  • Learn about Windows application development
  • Understand the role of GUI toolkits
  • Implement advanced Code::Block features

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 25, 2013
Length: 128 pages
Edition :
Language : English
ISBN-13 : 9781783283415
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Oct 25, 2013
Length: 128 pages
Edition :
Language : English
ISBN-13 : 9781783283415
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 43.99
C++ Application Development with Code::Blocks
$43.99
Total $ 43.99 Stars icon

Table of Contents

5 Chapters
Getting Started with Code::Blocks Chevron down icon Chevron up icon
App Development with Code::Blocks Chevron down icon Chevron up icon
App Debugging with Code::Blocks Chevron down icon Chevron up icon
Windows App Development with Code::Blocks Chevron down icon Chevron up icon
Programming Assignment Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.3
(4 Ratings)
5 star 0%
4 star 0%
3 star 50%
2 star 25%
1 star 25%
Montana May 17, 2021
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
... marginal compiler setup and debug info... for an older version of Code Blocks.
Amazon Verified review Amazon
P. Hendrick Jan 02, 2017
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
UPDATE (Jan 2, 2017)For now, I am leaving the rating as 3 stars. (That might change later as I get more qualified to judge a book such as this.)Since yesterday's review, I have finished the Goetz introduction to Code::Blocks, mentioned below. I recommend that pdf file to anyone who is new to C:B. It got me going to where I feel comfortable working with basic C programs -- i.e., compiling them and running them (and doing a little debugging :>). There are only the most minor discrepancies between what is presented there and what you will see in actually running C::B. I think some of that are due to (a) continuing minor updates on the C::B web site not yet reflected in the update of the pdf online; and (b)I am suspicious that a slight variation in button pushes can skip over some of the common dialogs shown in screenshots, depending on the context.As to this book being reviewed on Amazon, I have finished up to a third of chapter 2 (not much, I admit), going through compiling and running a simple C++ program with a single file. But I don't know C++, and am in the process of trying to learn C first. I followed the logic of the first program OK (and it ran OK). But on the next program, involving multiple files, I quickly got passed by. I just don't know enough C++ at this point. I set it up and it ran OK, but I didn't get much out of that. And that is on me. Though there were explanations of what was happening, they were very concise.In my short read into this book, it has definitely gone past what is in the Goetz pdf, and there are about another 70 pages to go. (The pdf did cover some on debugging with C::B, and I haven't gotten into that with this Packt book, yet.)I believe the appropriate reader of this book is someone who has somewhat of an understanding of C++, including putting together several source files involving multiple classes. If you think this book will actually teach you the C++ language, I think you are misinterpreting the title. It is intended to teach you how to do what you already know of C++, but in a Code::Blocks environment.ORIGINAL REVIEW (Jan 1, 2017):Despite the earlier (and only) review which rated it one star, I am going to give this book a try. From the "Look inside" feature, it looked like it might be helpful, at least to me. I bought it as an e-book directly from the publisher's site, where it was fairly cheap (at least for now).I am giving this book a neutral (3-star) rating for now, and will update after I have finished it.I tried the documentation on the code::blocks dev site, but it was not helpful to me. I like to know what all the menu options and toolbars are for (and there are A LOT of these) and why I might want to select them, but that documentation seemed to be geared to someone who has a lot of experience with C/C++ compilers and project management, not me.Before I read this, I will finish reading Code::Blocks Student Manual (a free pdf) by goetz, et al., from CUNY; and come back and update to tell what this has that that doesn't. That pdf looks like it is kept very up-to-date as new builds of Code:Blocks are released. A partial reading has been so-far helpful to me. It does a good job of describing installation and some initial configuration.
Amazon Verified review Amazon
Peter Edwards Jan 17, 2014
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Modak has several books to his credit, so I expected a well structured teaching/reference book. This is not it. Modak is certainly no teacher. The book is a jumble of sketchy information seemly thrown at the reader. At £25 for 109 pages, it is expensive. I have been unable to find any good introduction to Code Blocks, so this book represents a wasted opportunity. Pity!
Amazon Verified review Amazon
Carol and Norm Dec 27, 2013
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
I have walls full of reference books and tutorials. This is probably the worst. If I could have given it a lower rating I would have.I consider myself an intermediate programmer although new to Code::Blocks. I'm not a professional programmer but more of a hobbyist. I've used IDE's in the past and was looking for a decent introduction to Code::Blocks to get me up and running. There are no other books out on using Code::Blocks so I jumped on this one, perhaps a bit impulsively.On its cover, this book promises that it will help you "develop advanced applications with Code::Blocks quickly and efficiently with this concise, hands-on guide." In the preface, it states that the target audience is C/C++ developers and that prior knowledge of C/C++ compiler is required. One would assume from this that the target audience is reasonably intelligent and experienced. Anyone in that category would likely feel insulted and ripped off by this book.The short and brief connotation of "concise" is certainly fulfilled. Including the appendix, it's only 109 pages. About two thirds of it is filled with mostly useless screen shots of the program's dialog boxes that only a moron or a high school student would find useful. The clincher for me was the screen shot of a blank Notepad window that takes up a quarter of page 61.The author attempts a tutorial style throughout the book. There are numerous pages of C++ code that he uses as examples. Although he claims to not be trying to teach C/C++, he felt the need to explain in significant depth what various lines of code were trying to accomplish. What's left of the book, the text in fairly large font, could probably fill out a fairly long magazine article that highlights some of the things you can do with Code::Blocks.The author is clearly not a native English speaker. That's ok as long as you have an editor that can back you up. The editor(s) clearly failed here. There are numerous grammatically incorrect sentences, although you can usually figure out what he is trying to say.Chapter 1 is about getting and installing the program. Go to [...] and download the program. Run the installation program and follow all the instructions accepting all the default values suggested. I think you would know to accept the license agreement and to click on the install button on the screen. Hover over the toolbar icons to find out what they do. There, I've just saved you 16 pages of useless reading.Chapter 2 starts off with the obligatory "Hello World" console program. If you're an experienced programmer, you can likely figure out what button to press to compile and run. He next develops a project with a couple of files in it, again as a console program. Again, if you're an experienced programmer, you can likely figure this out on your own too. He spends a few pages here on an introductory example of how to use the debugger. Next is an example of how to include an external library (conio2) in a project. The only part of this chapter I didn't already know was the page and a half discussion of workspaces.Chapter 3 is how to use the debugger in more depth. Pretty standard stuff again. If you've used any debugger before and know how to set breakpoints, there's nothing new here.Chapter 4 gives a couple examples of how to write a Win32GUI project and later a wxWidgets project with the wxSmith plugin. These are merely example programs. There is little or no talk about how to install wxWidgets and configure it to run in Code::Blocks. If you've worked in a RAD environment before, what he talks about is all pretty standard stuff.Chapter 5 is a tutorial on how to develop an image viewer. After my experience with the first four chapters, I decided to save myself from reading it.The appendix talks about a few other features of Code::Blocks: a short paragraph that you can use the Squirrel language to script changes to the program; a few pages on using Doxyblocks to document your code; a page on saving and reusing code snippets; a page saying you can configure other external tools to work with Code::Blocks.Although I consider myself to be a Code::Blocks novice, this book did not teach me anything that I hadn't learned by playing with it and Googling things I didn't know. If you expect any depth at all, or are hoping to learn how to set up the various compiler and linker options, you'll be sorely disappointed.If you want to really learn how to configure and use Code::Blocks, download the user manual from [...] or read the articles on the wiki at [...] If you want to learn about wxWidgets, go to [...] The rest you can get by Googling. Don't waste your time and money on this book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.