How to create new C/C++ project in CodeBlocks

Hello friends, being a beginner to C/C++ everyone once had this question Where to write C/C++ codes? How to compile it? How to run it?. Codeblocks provides an ultimate solution to all these mentioned problems.

Code::Blocks is a IDE(Integrated Development Environment) for creating C/C++ projects. It is simple to use and provides very basic but powerful interface. CodeBlocks can be used for creating, editing, compiling, running and debugging C/C++ projects. Here is a beginner guide to use CodeBlocks.

Before preceding you must have Codeblocks with C/C++ compiler installed in your computer. If you don’t have Codeblocks installed download and install it before moving to the next step.

Creating new C/C++ projects

  1. Click on File → New → Project
    Creating new C/C++ project in Code::Blocks
  2. Select Console application from the project category and then click on Go button.
    Creating new C/C++ project in Code::Blocks
  3. On the Welcome message dialog box, check the Skip this page next time checkbox. And click on Next button.
    Creating new C/C++ project in Code::Blocks
  4. On next screen the wizard ask you to choose the project type. Choose C if you want to create C project else choose C++ if you want to create C++ project and click on Next button.
    Creating new C/C++ project in Code::Blocks
  5. Next wizard screen enter your Project title and path where to store your project. Enter any title of your project suppose Hello World. Choose the file path where you want to store your C files. For choosing file path click on … button. And click on Next button.
    Creating new C/C++ project in Code::Blocks
  6. The next screen asks you to choose C/C++ compiler. If you have installed GNU C/C++ compiler then you need not to perform any action on this screen simply click on Finish button. If you don’t have GNU C/C++ compiler download it before preceding to next step.
    Creating new C/C++ project in Code::Blocks
  7. Congratulations you have created your first C/C++ project in Code::Blocks. But where do I write my first C/C++ program as no editor opens after last step. To open the code editor, navigate to the workspace area and click on + symbol present before Sources. That will expand the sources folder. Now double click on main.c file to open the code editor.
    Creating new C/C++ project in Code::Blocks
  8. Finally the code editor opens. Here you can edit you code, for saving your code just press Ctrl+S.
    Creating new C/C++ project in Code::Blocks

Running your C/C++ program

  1. To run any C/C++ program click on Build → Build and run or simply hit F9 from your keyboard.
    Running C/C++ project in Code::Blocks
  2. The output screen.
    Output screen of Code::Blocks