Wednesday, May 11, 2011

C(G)++ Compilers in Windows NT – The GNU Way!

When it comes to coding and programming, nothing can beat the linux. It has the most sophisticated compilers out there! Despite this fact, most of the people don’t feel comfortable working with Linux. Although there are certain alternatives and 3rd party softwares for Windows platform, nothing can get near the GNU compilers. They are updated, fast and error-free. So, GNU has given a windows version of its new compiler for download.

These are the steps to be done to get your system running with GNU C++ compiler!

  1. Download the GNU C++ compiler tool (full.exe) here. http://www.claremontmckenna.edu/pages/faculty/alee/g++/full.exe

Check for integrity – SHA1sum - 2266a1cbd63a8a06faf0e44332b678f3f57161aa

  1. Run the full.exe

clip_image002

  1. It’s a normal setup just like anything else. When you’re done installing it, you need to add the path environment variable. We’ve already seen as to how to add the path variable in glomosim installation setup. If you still find it difficult, brush through the glomosim installation setup guide, ( http://ubuntuone.com/p/kXU/ ) point 1 where we have given how to add environment variables for Visual Studio. In this case for G++ compilers, you just need to do it for path variables with the path address, C:\cygnus\cygwin-b20\H-i586-cygwin32\bin with a semicolon – ‘;’.

That is you add it like <previous path addresses>; C:\cygnus\cygwin-b20\H-i586-cygwin32\bin;

  1. For those of you who still find it difficult to add the environment variables, I’ve given a VBScript file that can make things easier for you. Just run it once and your path variables would be added for you. BUT YOU GOTTA RUN THAT ONLY ONCE AND THIS SCRIPT FILE WORKS ONLY FOR THE DEFAULT INSTALLATION DIRECTORY GIVEN BY THE FULL.EXE SETUP. If you install the setup somewhere else, you gotta  tweak the script file. It’s easy, open it through the notepad, look for where the original path has been provided and replace it with that path that you’ve used.

Download the VBScript file here: http://ubuntuone.com/p/sRx/

  1. After setup, go for a system-reboot
  2. You’re done. Now just type, g++ followed by the cpp file path
  3. If yours gets compiled successfully, no errors show up. Else error warning comes up. You gotta manually edit the errors using some text editor.
  4. After compiling, just like how you use . /a.out for the a.out file in linux, you use a.exe to view the output here.This is an other alternate way to produce exe files for your c++ codes.clip_image004
  5. Thanks to the Cygwin project !
  6. Download the instruction manual here : http://ubuntuone.com/p/sS2/

No comments: