Codeblocks is an Integrated Development Environment (IDE) for programmers and developers. It comes with predefined tools to develop Qt applications, plugins, console applications, etc. considering one has installed the required tools independently (eg- Qt development tools). Most IDEs come with “project” feature and that’s the turning point because some of them requires user to create one before proceeding any further, where in some cases programming (in schools and colleges) exercise don’t really need tedious task of creating and setting up “projects” (More to this later).
How To Install CodeBlocks?
To install codeblocks launch the terminal emulator program (probably shortcut key is ctrl+alt+t) and execute the command below -
sudo apt install codeblocks*
The reason why an asterisk is suffixed with the word codeblocks is because on Ubuntu (maybe other distributions too) codeblocks alone does not install all the plugins required and certain productivity features are also missing.
Creating a new project
To create a new project click on File>New>Project and select the required one from the wizard box that follows.
Creating an empty project
Well, this is the most awkward topic here, since many would develop rich programs using codeblocks while the minority/few of us only need this powerful IDE features to speed up our programming task by running small programs just for the sake of demonstrating a specific algorithm. To create an empty file and execute the code at the instant, one should select ‘Empty file’ from File>New options, but the best practice is to use the shortcut keys ctrl+shift+n and you’ll get an empty file in the workspace as shown below:
Common CodeBlocks features and how to
There’ll be tons of reliable features but over here I’ll be discussing only three common ones that any programmer can feasibly utilize it.
I’m not talking about the auto keyword in C++, rather the “word completion” feature everyone has utilized it on LibreOffice writer and trust me this is a lot helpful for many of us who loves speed! And are too lazy to key in every single statement word after word. How one could use it by simply pressing the Enter key once the required word pops up.
Or select one suitable from the many list. But the recommended practice is to type in at-least more than two to three letters so you get more accurate word detection than using the cursor key to browse for it up and down.
This is also another important tool in modern programming because there is usually a need to copy certain blocks of code again and again for the reason that the program is a choice intensive one (eg- a program where there exists probably more than one to do condition based on if-else-if choice). Many would ponder ctrl+c and ctrl+v is the right method but trust me that’s too slow and tedious if you have to copy one that already exists and re-edit them after pasting it. Instead, highlight the code you wish to copy and paste then wait to stop here! Before you go on to ctrl+c, go to ctrl+d and that’ll duplicate the whole line of codes you just highlighted after the source.
The above screenshot is not a real program! Just a dummy illustration, but you get the fact here right? Notice how I skipped the condition value of switch cases and instead left a skeleton code for later purpose. That’s how fast duplicating a block of statement(s) is in real working programs!
Last but not least is one student and lecturers usually encounter almost everyday in their lab class, moving certain statement(s) here and there, up and down, or from file to file, etc just for the sake of debugging an error that crept up during the building process. And like above “line duplicating” here is also another poor tricks (ctrl+x & ctrl+v) used by many of them. No offense! But this is the case when someone has been programming C/C++ on Turbo C IDEs, then maybe 3 yrs later had to catch up with the fast-paced technology.
So then to move one or more statements up and down, place the cursor on the line and press alt+arrow key like the one shown below:
Time to wind up here and maybe I forgot something. Yup! Codeblocks works better for C and C++ programmers. I recommend using Netbeans or Eclipse for developing Java programs. Have fun coding :)