Introduction to C programming/What you need before you can learn

From Wikiversity
Jump to navigation Jump to search

For this course, we will be using the GNU compiler. [1] Other compilers exist, but GCC should work for now.


To install GCC on a Macintosh system, all you need to do is download and install Xcode. [2] Though we will not be using the Xcode editor until later, you may want to explore the interface now to get a feel for what we'll be getting into later on.

The next step is to open terminal. Terminal is a utility included in OSX. (Applications > Utilities > Terminal.) This is where we will be doing almost ALL of our programming. We will go over the commands that we will be using in the first lesson. For the moment, simply open a terminal and enter "gcc" and press return. You should get a message that says "no input files" at the end. If so, you have correctly installed the gcc compiler.

The last step is to install emacs. [3] This is one of the world's most flexible and universally compatible text editor. It is highly advised that you install this editor and learn how to use it well. (There will be a section on text editors later on.)


FreeBSD: You can use clang directly by invoking "clang" or may use the default compiler using "cc". You may also install gcc by running "pkg install gcc" or by installing the devel/gcc port.


If you are using apt, run the command "apt-get install gcc-4.3" and replace the 4.3 with the latest version of gcc. [1]