How To Create and Run Project In Code::Blocks - Ocean of Programming

Wednesday, 17 May 2017

How To Create and Run Project In Code::Blocks

        In the previous post, we have seen how to download and install Code::Blocks for C programming. If you did not read that article then read How to Download and Install Code::Blocks before proceeding further.
       The code block is a popular application for C Programming. It is open-source, cross-platform, free C, C++ and Fortran IDE. Using Code::Blocks we can write C code, compile and run it. It popular application and free to use. 
       In this post, I am going to explain how to run and compile C program code in Code::Blocks. Lets us follow the procedure. The procedure is same for every project. 
        In the first step you have to double-click on the Code::Blocks icon which on the desktop. After that, you will see window like this and you have to click on Create New Project.
         After selecting Create New Project the new window will pop up named New From Template and you have click on Console Application click on Go.
       After selecting clicking on Go yo will pop up a new window named Console Application and you have to select C or C++ project. We are creating C project so select C and click on Next.
         After that, you have to enter the project name and path for saving the program. I have given the name sample and selected path as a desktop. You give your program name and required the path for saving the program. Path selection is a must for the first time it cannot select path automatically. After that click on Next.
After that, you will pop up a new window of the compiler. You can change another compiler but keep GNU GCC Compiler or if another option is selected then change and select GNU GCC Compiler and click on finish. You will see new project window.
          After that double click on Sources and new sub-menu main.c will open and double-click on that menu.c file and you will see a new file with some pre-written code.
           For compile the code select build option from Build menu or press Ctrl+F9.
        After completing compilation click on run from Build menu or press Ctrl+F10. A new black window pops up with output.
           In the above image, the output of the program is shown. 
           Note: If  installing Code::Blocks second time then it might give error if program is correct in this situation you may first delete registry files of Code::Blocks and uninstall and again install Code::Blocks it will start working but be careful if by mistake you deleted the other files it may damage your computer. Try deleting registry files only if you know all the things. I have tried this and its worked on my computer. For any damage to your computer by deleting registry file I am not responsible for that try at your own risk.
        Please feel free to comment if you find anything incorrect or you want to share more information about the topic discussed above.

No comments:

Post a Comment