Monday, July 27, 2009

I wish to practice C programming .how do i install the compilers?

Given the information presented, I will assume you are on Windows. If you want to practice C or C++ programming from with commercial compiler it's really simple. For Microsoft give them and arm and a leg, they will send you a CD, and it will run an installation program which will -- Don't use their compiler. I am a Microsoft hater and I have reasons. Visual C++ is one of them. With Borland you have a choice of buying the CD or downloading it. Either way, on Windows it is pretty straightforward.





Digital Mars's C/C++ compiler is pretty awesome. I actually only used it for a very few months during my transition from Windows to Linux and I only used the free command-line version but there is a $54 CD with an IDE (integrated debugging editor) on it and I do recommend trying that if you want a really well-written compiler. Installing the free version of the C compiler is straightforward: you download the zip file, unzip it, read the readme file, open an MS-DOS window and you're ready to go. For C++ it is a little complicated. You download and unzip the STL port file (STL is the name of the packages which contain the latest versions of the C++ header files and libraries) read the readme and move the directory into the proper relationship with that of the C compiler. I also wrote a short bat file which allowed me to call the compiler with all the C++ libraries. It's still awesome once you get it running.





GCC is one of the oldest compilers out there. Linux is built on the GCC libraries (it was written for Unix) and most version of it include it as part of the package. It's the original Free Software program. There are two flavors out there. DJGPP is the older port. It was originally written for MS-DOS and of course is kept up to date. The thing is its graphic user interface support is a joke. To get it, go to http://www.delorie.com/djgpp click on the zip picker link and follow the instructions they give you there. You will do the whole thing in MS-DOS boxes.. Bloodshed Software's Dev-C++, which many of the same people have worked on, is a C/C++ compiler with a n Integerated Debugging Editor (something you want) which runs on top of a small Unix emulator called Mingw. Get it at http://www.bloodshed.net/dev/devcpp.html and once more, follow the instructions.





Finally there is the question of using Linux. If you are already using UBUNTU, the one version which doesn't just come with the C compiler out of the box, type into a terminal "sudo apt-get install build-essential". Then you'll be ready to go, once the binaries are installed on your system.





If you don't know what the last means, there is a simpler way of using Linux which is also worthwhile. More worthwhile. You see there is this developer and computer consultant in Germany named Klaus Knopper who developed his own version for use with his work. Since he's a computer consultant it usually comes on a live CD or DVD you can put in your computer and if your computer boots from the CD drive it does an awesome job of hardware detection and will usually get your system up and running fast. To just get a taste of C and C++ there is nothing easier than booting it up and writing and compiling programs. If you connect to the internet via broadband then it will probably detect that and bring it up (the only time I ever had any problem with it was when I tried to connect to a wireless connection I later found out I had no business using anyhow. A misunderstanding). The "down" side is Knoppix does everything in memory. You must TELL it to save things to disk. The default is a /home/knoppix directory which on most systems would be on the hard drive, but here is just a place in memory which will go away once you reboot or shut down. If you are proud of a program you got working, you can save the source code to the hard drive or to a floppy by "Mounting" it (right click on the icon of the drive and select the Mount option) and copying it to disk. You run GCC and g++ from a terminal (the equivalent of M$'s MS-DOS prompt), but just about any editor you can select to write it will work like an integrated debugging editor. (You can also copy executable files to disk but you can't run them under Windows. You'd have to recompile them). And of course when it reboots you will find yourself back on windows -- or awake and find yourself on the cold hill side.

I wish to practice C programming .how do i install the compilers?
Might also want to check out Comeau C/C++ - look at http://www.comeaucomputing.com/





Price is $50.
Reply:Depends on what operating system you're using -- and you didn't tell us that!


No comments:

Post a Comment