How to use Code::Blocks ?

So I want to ask the following questions on how to use code::blocks -

  1. How do we use code::blocks with linux terminal?
  2. How do we submit a problem on codechef by coding on code::blocks? (Currently I am using the codechef ide)
  3. How do we debug on code::blocks? I have seen people clicking some buttons and the next step executed, so this helps them debug. Is this feature available on code::blocks? If yes then how to use it?
  1. Start a new project in Code::Blocks.

  2. Choose File→New→Project.

  3. Choose Console Application and click Go.

  4. Choose C/AnyLang and click Next.
    5.Type the project title.

  5. Click the Next button.

  6. So far, these first few steps are the same as for creating any C language console program in Code::Blocks.

  7. Place a check mark by the Create “Debug” Configuration.

8.The Debug setting allows a program to be created with special debugging information included.

9.Ensure that the item Create “Release” Configuration is also selected.

10.Click the Finish button.

The new project appears in Code::Blocks.

Type your code and click on any line number on the left to set breakpoint

Now,

View→Toolbars→Debugger.

And click on the next button to run through the code step by step

2 Likes

@mathecodician @swetankmodi has told about how to use Code::Blocks, to submit, just click upload file after saving on CodeChef, locate your file and submit.

Though I’d recommend not using any IDE for practice for contests like IOI as over there you may not be getting a good IDE, so you should practice with only a terminal and Vim, though this seems to be difficult at first, getting used to this means no matter what you get on spot, you’ll be good to go.

1 Like

Ok we already know how to use Code::Block , here I will show you to use gEdit (default for distros with Gnome with terminal plugin) ,

Reasons for choosing gEdit : lightweight , less cluttered , easy for eyes and that terminal plugin

Ok first we have install gEdit plugins :

sudo apt-get install gedit-plugins

(if you using Debian based distro)

Now activate that plugin in gEdit plugins menu.

Done , tada now you have an awesome text editor suited for competitive programming.

alt text

For compilling and debugging the program,

You can just right click on the terminal at the bottom and choose “Change Directory” to change to the current directory.
Then g++ <program_name> to compile a program

alt text

To run the program just do an ./a.out

alt text

For debugging you can use gdb ,

sudo apt-get install gdb

While compilling use -g flag and then gdb a.out tada now you can debug properly

alt text

2 Likes