Intro To Codeblocks With C++
Codeblocks is an IDE and in this section I want to show you how to get started using it with C++.
Table of Contents
Introduction
Codeblocks is a popular IDE. It works very well on Linux or Windows. It supports projects, syntax highlighting, and debugging your code.
Installing Codeblocks
I recommend using your package manager. This will make it easy and usually a simple command to get it done. If you need a binary, you can go to their website. If you go to the Codeblocks site, you should just get the binary that includes the MinGW compiler. Both are installed at once.
Compiler
You will need a compiler to use with Codeblocks. If you are on Linux, you already have one installed. If you are on Windows, you can get one on the Codeblocks website as a complete package. When you open Codeblocks for the first time, you can select the compiler that you have installed. Click the button to the right to make it the default.
Using Single Files
You should create a folder to hold your single files. This will allow you to be more organized and be able to find them quickly. If you want to do a quick test, you can go to your menu and hit create.
- Select File
- Select New
- Select Empty File
This just creates a blank file for you to put some code in to see if you have everything setup correctly. Then you will go to your menu again to build and run.
- Select Build
- Select Build & Run
These options will build your files into object code and then run your code. You will see a small console screen with your output if everything went correctly.
Creating Projects
Again, I would create a folder to store your projects in. With this method, you will know where everything is at all times. To create a project, go to your menu and hit create project.
- Select File
- Select New
- Select Project
- Select Console Application
- Select C++
Now, you name your project and select the project folder you created earlier. Once this is done, you can add files to your project that you are working on. If this does not make sense yet, do not worry, you will know when you need to do this. So at first, you will just be working with single files to learn.
Conclusion
In this short guide, we talked about how to install Codeblocks and a compiler with it. Afterwards, I showed you how to create single files with some code in them. Then, we created a project, which will help us with larger tasks sometime in the future.