In the past week I have been asked a countless number of times how to install GCC ( GNU Compiler Collection ). I have been using it in my C Video Tutorial.
I show you how to install GCC on Windows as well as on a Mac in the video below. Not only did I make a video, but I also have everything listed step-by-step below after the video. If you have any trouble setting this up, leave a comment below and I’ll try to help.
If you like videos like this, it helps to tell Google+ with a click here
How to Install GCC on Windows
1. Download the MinGW Installer here ( Click the green download button )
2. Run the Installer
3. Pick which ever languages you want to compile as the installer runs. Make sure you save MinGW in C:\MinGW though to avoid a ton of problems
4. Open the Command Prompt ( It is in the Accessories Folder in Start )
5. Add MinGW to the Path either by:
a. Type set PATH=C:\MinGW\bin;%PATH%
b. Or, go to Control Panel – System Security – System – Advanced Settings. Then click Environment Variables and click on PATH and Edit. Then add this to the end and save ;C:\MinGW\bin
6. In the Command Prompt type gcc -v to see if it worked. ( You may have to restart the Command Prompt )
How to Install GCC on Mac
It is very easy to install GCC 4.8.1 on a Mac if you have Mac Ports installed. Here are the steps to set everything up:
1. Go to MacPorts and install it by downloading the DMG and installing it. Make sure you pick the right version based on your operating system version.
2. Open your Mac Terminal ( Applications – Utilities – Terminal )
3. Update MacPorts by typing this in the terminal sudo port selfupdate
4. Install GCC 4.8 by typing this in the terminal sudo port install gcc48 ( This can take a while to install )
5. Now change the default version of GCC by typing this in the terminal sudo port select –set gcc mp-gcc48
6. Now type this in the terminal hash gcc
7. Test if you are using the new version of GCC by typing this in the terminal gcc -v
If you see version 4.8 in what follows, congratulations you have the updated version of GCC and you are ready to start writing C11 programs.