amazon

Saturday, 6 September 2014

Make Perfect C environment on Windows

Ubuntu got a perfect C environment but very bad entertainment and its really irritating to keep switching from ubuntu to Windows again and again for beginners its better to stay at Windows with a good programming environment. I referred to many sites but was unable to setup, worse codeblock was failing again and again due to some reason and most importantly its really a bad to compile on codeblock it dosent give actual feel, experience of programming and at last first time in history an Indian government site published perfect way to setup.

Organisation is known as NPTEL by IIT's to provide quality education and is really a very good option to study.

To join online course visit NPTEL

Here we go....

Go to the MinGW download site
Go into the Installer folder and download the file mingw-get-setup.exe.
Run the downloaded file on your computer, accept all the default settings and continue. You should get the following screen:
pic1.png
Click on “Continue” and the MinGW Installation Manager will open and look like this:
pic2.png
Mark the following packages for installation
mingw-base
mingw-gcc-g++
Click on Installation->Apply Changes.
The installer will then download the needed packages. Your screen will look like this:
pic3.png
Once the installation is complete, the following confirmation screen will show:
pic4.png
Click on “Close” and exit the MinGW Installation Manager.
Download and Install Notepad++
Go to the Notepad++ download page:
Download Notepad++ Installer.
Run the Installer and accept all the default options to install Notepad++.
You should now be able to run Notepad++ from the Start menu.
Setting up the system for programming
First of all create new folder on your disk to keep all the programs separately. Lets say you create it in your C drive can call it “code”.
Since MinGW was installed using default options, it should be in the C:\MinGW folder.
We will now create a short batch file to setup the command prompt to work with MinGW.  
Open Notepad++, create a new file with just the following command:
PATH=C:\MinGW\bin;%PATH%
Save the file as “setup.bat” in the folder c:\code.
Now you are ready to edit and compile programs.
How to edit and compile programs
Open Notepad++, write your program there and save it in the C:\code folder. Lets say the program is called “sample.c”.
Open the Windows Command Prompt. Change to the code folder by typing:
cd c:\code
Setup the command prompt using our batch file like this
C:\code>setup.bat
You can now compile your program like this:
C:\code>gcc sample.c
If there are errors, you will have to go back to Notepad++ to change the code.
If compilation succeeds, you will see the file a.exe created in the same folder.
Run the program like this:
C:\code>a.exe
By default every successful compilation will result in a.exe getting created and overwritten for every subsequent compile. If you want a different name for your compiled program, you should add the output file name to the gcc command like this:
C:\code>gcc -o sample.exe sample.c
And then run the program like this:
C:\code>sample.exe
That’s it !! You are ready to code.
Happy learning.
Tips
You only need to run the setup.bat file once when you open the command prompt. After that the settings will stay until you close that command prompt.
For fast switching between editing the code in Notepad++ and compiling on the command prompt, keep both open and keep switching using Alt+Tab. Like this screen:
pic5.png

You are here NBI -> Life Now Easy -> Make Perfect C environment on Windows
Please us to Improve - Feedback

2 comments:

thanx
you are really brilliant

Thanks for some other fantastic post. Where else may just anyone get that kind of info in such a perfect approach of writing?
I've a presentation subsequent week, and I'm at the search for such info.


Here is my web-site: FaeSSchapp