Wednesday, September 25, 2013

C++ Tutorial #2: Installing Dev-C++ and a Compiler


The program you're going to want to install is called Dev-C++, and you can download it here.  Download "Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2" (it's the first option).

It includes two things.  The first is the actual Dev-C++ program.  It includes a color-coded editor (which is EXTREMELY helpful because different parts of the code have different colors) and a relatively simple interface (I actually don't use most of the buttons and options it comes with, so don't be intimidated by them).  The second part (the "Mingw/GCC") is the compiler. After you write your code with the Dev-C++ editor, you'll use the GCC to compile it into machine code.

Here are the installation/setup instructions:

1) Download the program from the link I provided.  (I've used SourceForge before; you're safe.)

2) There will be a file in your "Download" folder called "devcpp-4.9.9.2_setup.exe".  Run it.

3) Follow the installation instructions.  Your installation folder should be: "C:\Dev-Cpp"

4) When you get that scary error message ("The following directories don't exist...") just click "Yes".  It will install the compiler for you.

5) Open Dev-C++ (search for it and it should pop up).

6) On the toolbar, go to Tools > Compiler Options > Directories.

There will be a little box you can use to browse for the compiler directory (the folder where your compiler is).  This is what it looks like:


Click on that and browse for the following folder (don't worry, I'll include a picture too): C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2.

I do hope these motivational smileys are helping.

Once you find it, click "OK" and then "Add".  You should see that horribly long directory appear in the box like so:

Motivation with a capital M.

7) Next, click the "Programs" tab.

In the first line (dubbed "gcc:"), leave the text in the box alone (it should say "gcc.exe") but type in some extra stuff before it: C:\Dev-Cpp\Bin\.  So the first text box should say C:\Dev-Cpp\Bin\gcc.exe.

8) Do this with all the other text boxes (tip: you can save time by copying "C:\Dev-Cpp\Bin\" and pasting them in the other boxes).  Make sure that your end result looks like this:

 Notice how you just added that one string to every line?
Don't DELETE anything from the text boxes, just add to them.

9) Click OK.  The installation process is over.

You now have two new programs: Dev-C++, which will help you write and edit programs, and the GCC compiler, which will help you translate them into machine code.

You're ready to learn programming.

No comments:

Post a Comment