Video Pending

Created by Zed A. Shaw Updated 2024-02-17 04:54:36

Exercise 0: The Setup

The traditional first exercise, exercises 0, is where you setup your computer for the rest of this book. In this exercise you'll install packages and software depending on the type of computer you have.

If you have problems following this exercise then simply watch the exercise 0 video for your computer and follow along with my setup instructions. That video should demonstrate how to do each step and help you solve any problems that might come up.

Linux

Linux is most likely the easiest system to configure for C development. For Debian systems you run this command from the command line:

$ sudo apt-get install build-essential

Here's how you would install the same setup on an RPM based Linux like Fedora, RedHat, or CentOS 7:

$ sudo yum groupinstall development-tools

If you have a different variant of Linux simply search for "c development tools" and your brand of Linux to find out what's required. Once you have that installed you should be able to type:

$ cc --version

To see what compiler was installed. You will most likely have the GNU C Compiler (GCC) installed but don't worry if it's a different one than what I use in the book. You could also try installing the Clang C compiler using the Clang's Getting Started Instructions for your version of Linux, or searching online if those don't work.

Mac OSX

2024 Note: Now you only install XCode from the Apple store and there are no more DVDs. If you don't have internet access I think you can go to an Apple store and ask to use the network to download XCode. They'll probably let you or help you.

On Mac OSX the install is even easier. First, you'll need to either download the latest XCode from Apple, or find your install DVD and install it from there. The download will be massive and could take forever, so I recommend installing from the DVD. Also, search online for "installing xcode" for instructions on how to do it. You can also use iTunes to install it same as you would a generic app, and if you do it that way you'll receive updates automatically.

To confirm that your C compiler is working type:

$ cc --version

You should see that you are using a version of the Clang C Compiler, but if your XCode is older you may have GCC installed. Either is fine.

Windows

For Microsoft Windows I recommend you use the Cygwin system to acquire many of the standard Unix software development tools. It should be easy to install and use, but watch the videos for this exercise so see how I do it. An alternative to Cygwin is the MinGW system that is more minimalist but should also work. I will warn you that Microsoft seems to be phasing out C support in their development tools, so you may have many problems using Microsoft's compilers to build the code in this book.

2024 Update These suggestions will still work but don't use VirtualBox. Use Windows Subsystem for Linux as it's the best way to run Linux on Windows. For Linux distro try Ubuntu or whatever Microsoft recommends.

A slightly more advanced option is to use VirtualBox to install a Linux distribution and run a complete Linux system on your Windows computer. This has the added advantage that you can completely destroy this virtual machine without worrying about destroying your Windows configuration. It's also an opportunity to learn to use Linux, which is both fun, and beneficial to your development as a programmer. Linux is currently deployed as the main operating system for many distributed computer and cloud infrastructure companies. Learning Linux will definitely improve your knowledge of the future of computing.

Text Editor

2024 Update I've updated my recommendation here to use Geany, if you have opinions on VisualStudio Code for C editing then let me know in a bug report.

The choice of text editor for a programmer is a tough one. For beginners I tell them to just use Geany since it's simple and works for code. However, it doesn't work in certain internationalized situations, and chances are you already have a favorite text editor if you've been programming for a while.

With this in mind, I want you to try out a few of the standard programmer text editors for your platform and then stick with the one that you like best. If you've been using Geany and like it then stick with it. If you want to try something different, then try it out real quick and pick one.

The most important thing is do not get stuck picking the perfect editor. Text editors all just kind of suck in odd ways. Just pick one, stick with it, and if you find something else you like try it out. Don't spend days on end configuring it and making it perfect.

Some text editors to try out are:

There is probably a different editor for every person out there, but these are just a few of the free ones that I know work. Try a few out, and maybe some commercial ones until you find one that you like.

WARNING: Do Not Use An IDE

You should avoid using an Integrated Development Environment (IDE) while you are learning a language. They are helpful when need to get things done, but their help tends to also prevent you from really learning the language. In my experience, the stronger programmers don't use an IDE and also have no problem producing code at the same speed as IDE users. I also find that the code produced with an IDE is lower quality. I have no idea why, but I highly recommend if you want deep solid skills in a programming language that you avoid IDEs while you're learning.

Knowing how to use a professional programmer's text editor is also a useful skill in your professional life. When you're dependent on an IDE you have to wait for a company to sell you an IDE before you learn newer programming languages. This adds a cost to your career, and prevents you from getting ahead of shifts in language popularity. With a generic text editor you can code in any language, any time you like, without waiting for anyone to add it to an IDE. A generic text editor means freedom to explore on your own and manage your career as you see fit.

Previous Lesson Next Lesson

Register for Learn C the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.