Get A Spiny Norman Shirt Get A Shameless42 Shirt Get A Tux Shirt
top pipe
Get Firefox!

C For Yourself

Getting Started

This will be a short entry concerned with setting up your compiler. Because I've adopted the philosophy of keeping this series OS agnostic, and by extension, compiler agnostic, I'll just be posting a set of pointers to various resources that will help you set up your own compiler. As you will see, choosing a compiler is usually a pretty easy job.

Find A Compiler

If you are stuck for an answer, the usual default is the GNU C Compiler (GCC). It is available for the PC and almost every type of popular workstation class machine on the market. It is also possible to set GCC up as a cross-compiler, which is a compiler that runs on one system, but generates output intended for another. If you are running any of the free *nix systems (like Linux or FreeBSD), it is likely that you already have a copy of GCC on your system, or it is available on your install CD's. If not, you can find various binary distributions at http://gcc.gnu.org/install/binaries.html, You can also download the source for the GCC compiler from http://gcc.gnu.org/install/index.html If you are just starting out with C, the sources are nothing more than a curiosity until you understand what you are looking at. Besides, they require that you already have a working compiler on your system.

For PC's running Windows, the usual answer is VisualStudio.net. Unfortunately, that answer is not free, or even cheap for most of us. If you intend to do a lot of Windows programming, Visual Studio is a very good choice, but the only part of VisualStudio that is necessary for C programming is Visual C++. Check out http://msdn.microsoft.com/howtobuy/visualc/default.aspx for Microsoft's list price. It's also a good idea to shop around for a better price online.

If Visual C++ is a little too steep for you, you might be interested in some of the free alternatives. You can start by checking out the free GCC installations mentioned earlier. You can also try out http://www.cygwin.com/. Cygwin is a Unix-like environment that has it's own version of gcc available for it.

If you are using an Apple Macintosh, you may want to check out http://developer.apple.com/tools/ Unfortunately, I am not a Mac programmer, so I can't give an opinion on how good this site is, but I would suspect that developer.apple.com would be a good place for an Apple developer to go.

Choose a Text Editor

Once you have a compiler ready, you'll want to find a text editor to write your software with. If you are using something like Visual Studio that includes an Integrated Development Environment (IDE), you can skip this part, since the program editor is included with the compiler.

When making your choice, make sure that you avoid word processors . The difference between a text editor and a word processor is that word processors save text and formatting, while a text editor just saves the text. As an example, Microsoft Word is a word processor, and is unsuitable for programming. Notepad, however, is a text editor, and it usable for programming.

Some examples of *nix text editors are VI, which is included in most distributions, Emacs, which is my personal favorite, and KWrite, which is the KDE answer to Notepad. If you are using Cygwin, you can find versions of VI and Emacs for that too. In the Windows scenario, Notepad will do in a pinch, or you can find versions of Brief or TextPad online.

Consider Using Make

If you've done programming before, you have probably run into makefiles. These are specially written scripts that allow you to run a complex series of compilation instructions that can be directed to rebuild all of a project, or only certain parts of it. The program that reads these files and uses them to build your software is called make.

If you are using a compiler that includes an IDE, you won't have to worry about downloading and installing make, since IDE's usually either include a version of make, or they perform the same function internally. You also won't need to set up a makefile. You will, however, need to set the make parameters in your IDE properly.

Next Issue: Basic Language Features

Valid XHTML 1.1!