Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
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.

By BIPLAB MODAK
$25.99 $17.99
Book Oct 2013 128 pages 1st Edition
eBook
$25.99 $17.99
Print
$43.99
Subscription
$15.99 Monthly
eBook
$25.99 $17.99
Print
$43.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Oct 25, 2013
Length 128 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781783283415
Category :
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

Key benefits

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

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


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

Table of Contents

13 Chapters
C++ Application Development with Code::Blocks Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
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
Appendix Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.