Introduction

A development environment consists of the software tools used to edit, compile, debug, manage, and test source code. As this is an introductory course, we will be using a very basic environment in order to reduce the learning curve and to enhance understanding of the edit-compile-test process. This environment consists of three programs: text shell, text editor, and compiler.

The text shell provides a simple but powerful interface to the operating system (a command line interface). It can be used to start programs, provide text input, and get text output. The shell will be used to compile and test your programs. You will learn some very basic commands to navigate the filesystem, create directories (folders) and files, as well as compile and run your own programs.

A text editor is a program used to create and edit text, such as source code. This is different from word processing programs, which include formatting and other irrelevent information to programming.

A compiler is a program that translates source code into instructions the computer hardware can run directly, usually with the help of the operating system. The final output of the compiler is called an executable or library depending on the intended use.

1. Prerequisites

Windows 7 with the latest updates installed. If you are using Windows XP or Vista you should seriously consider upgrading, however we can help you individually to get things setup.

If you have already installed Visual Studio, then skip down to the Powershell configuration.

2. Compiler

We will be using the Microsoft command line compiler via Microsoft Visual Studio. I recommend, and will be using, MSVS 2012 Professional. For right now, we won't even be running VS except via the commandline invocation of the compiler.

3. Text Editor

You will need to learn how to efficiently use a text editor; which one is up to you. If you have less computer experience I recommend Notepad++ or gedit; those with more experience might want to consider emacs or vim, although be warned they have steep learning curves. Links to the installers for the above suggestions are below.

4. PowerShell

Powershell is the text shell we will be using. It is installed by default in Windows 7 but requires some setup to get it working with the compiler. I do recommend upgrading Powershell to 4.0 see the link above.

You may need to modify your settings to allow the PowerShell to run this script. More details will be added as soon as I get a good way to do this.

  1. Create a directory in your Documents directory called WindowsPowerShell.
  2. Now create a text file named Microsoft.PowerShell_profile.ps1 in your Documents directory (create the directory first) with the contents,
  3. Copy and paste the script below into the Microsoft.Powershell_profile.ps1
function Get-Batchfile ($file) {
    $cmd = "`"$file`" & set"
    cmd /c $cmd | Foreach-Object {
    $p, $v = $_.split('=')
    if($p -and $v){
        Set-Item -path env:$p -value $v
    }
    }
}

Get-Batchfile("c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat") 2> $null

You can create the directory using the Windows Explorer or the mkdir command in Powershell. You can create the ps1 file in notepad or any of the editors in the list above. I don't recommend notepad because it will add a .txt extenstion. This last line assumes that you are using MSVS2012, notice the Microsoft Visual Studio 11.0 in the path. If you are using a different version of Visual Studio you will need to edit this line.

You will probably get an error when you start the PowerShell, then run this command:

Get-ExecutionPolicy

If this returns Restricted, then restart the PowerShell as an Adminstrator.  To do this, right click on PowerShell in the Start Menu and choose Run as Administrator

Now type Set-ExecutionPolicy RemoteSigned.  When prompted enter Y to confirm the change.  Restart the PowerShell and the error should go away.  Enter cl should give an error about missing files for the compiler.

5. Other hints / tweaks


There are a few other items that will make your environment nicer and more productive.


These instructions in a text file