Code::Blocks is an open source IDE for C and C++. After trying lot of ways to run C programs on my Windows 7, I found this a better option than DosBox. Because I have experienced problems like mouse couldn’t work properly in some cases then you would have keyboard shortcuts as only option to operate environment. While CodeBlocks has a consistent look with plugin framework.
By means of plugin framework Codeblocks is extensible to great features. In fact it doesn’t come with compiler, debugger and make file features. You can and you have to add them as plugins. So let me start the tutorial.
Download latest version of Code::Blocks. It may be 10.05.
Install it with all recommended settings.
Download latest Compiler and Debugger from TDM-GCC.
Install it. Recommended in C drive (or in your system drive). It would be like C:/MinGW or C:/MinGW64 according to version you have downloaded. If your system is 64-bit then download MinGW64 otherwise go for 32 bit package.
Here comes main and a little bit tricky part. Now you have Code::Blocks and TDM-GCC installed on your system, open it up (codeblocks.exe). Follow the given path
Settings (Menubar) > Compiler and Debugger… (Sub Menu) > Toolchain executable (Tab)
In current dialog box set GNU GCC compiler as Select Compiler from the list. Most probably it would already be set by default. Now click on Auto Detect button but if it pop up that “cannot auto detect” or some similar message then add full path of main directory of installation (e.g. C:\MinGW64 in my case.) in ‘Compiler’s Installation Directory’ text box.
Now for different features like Compiling, Debugging etc we need to provide their full paths to text boxes under the “Program Files” tab. To browse the given files click on button at right most side and navigate to MinGW or MinGW64 and find proper .exe file. Here I have given setting what I have set for my device.
|Linker for Dynamic libs||:||g++.exe|
|Linker for Static libs||:||ar.exe|
After setting your Compiler and Debugger programs with Code::Blocks click on OK. You can now write and run programs of C and C++ in Window 7/Vista without any hassle.