Never confuse education with intelligence, you can have a PhD and still be an idiot.
- Richard Feynman -



Chapter:Setting up your C development environment

From Juneday education
Jump to: navigation, search

Meta information about this chapter

Expand using link to the right to see the full content.

Introduction

Having a development environment is crucial when developing. This chapters tells you how to install a shell, a C compiler and an editor.

Purpose

Make sure every student have a development environment setup.

Goal

No educational goals.

Instructions to the teacher

Common problems

It is very important that all students complete this chapter in due time, since the rest of the chapters requires that the tools are in place (and all examples are using these tools). Also, this book is based on exercises and without a functional environment the students won't be able to do the exercises.

It is common for students using windows to get confused by Window's default setting "hide extension for known file types". It is good to turn that option off, so that extensions are always shown. This will hopefully avoid situations such as students ending up with file names such as "hello.c.txt" while seeing only "hello.c".

Also, we recommend using a text editor such as Atom (since we don't teach IDEs and we definitely don't want to promote using notepad!). When we installed the Atom editor, again, the installer didn't set the PATH to the editor and it was actually some work to figure out where it was installed...

Chapter videos

No videos specifically for this chapter. The sections conatin links to pages which in some cases include links to videos.

Your environment

Your environment for the Programming with C programming book consists of these parts:

  • Terminal environment with a Shell (e.g. Cygwin and bash)
  • Editor - e.g. Atom - a text editor for writing programs and text
    • Install Atom
    • For advanced users with a developing background and experience from using the command line in UNIX-like environments, we recommend emacs or vim (probably not a good idea for beginners).
  • Additional software (see below)
    • gcc (GNU Compiler Collection) and other tools are included in the "Additional software" (see below)

Additional software for prog-c

Automatic installation of additional software

You will also need some additional software in this course which you can install in any of the two ways using a terminal:

Download script and execute
  1. Download our boot strap script for this course jd-prog-c.sh:
    curl https://raw.githubusercontent.com/progund/utils/master/bin/jd-prog-c.sh -o jd-prog-c.sh
  2. make the script executable
    chmod a+x jd-prog-c.sh
  3. and execute it (with verification - recommended)
    ./jd-prog-c.sh --verify to skip verification, simply enter ./jd-prog-c.sh
Execute from web

curl https://raw.githubusercontent.com/progund/utils/master/bin/jd-prog-c.sh | bash

Manual installation of additional software

The script above uses files containing a list of packages to install. Here are links to the packages file for each platform we support. Install the packages in these files:

Videos

  • Install GCC on Windows10 using cygwin (manually): (eng) (not needed if you've followed the instructions above)
  • Navigate through directories using ls, cd and pwd and create and remove directories and files using mkdir, rmdir and rm (eng)

Questions and Answers

Expand using link to the right to see the full content.

Q: “You have chosen to use a terminal and this bash shell thing, throughout the course. What’s the reasoning behind that? Aren’t there any fancier tools for programming in C?”
A: We don’t know about fancy, but we have some reasons behind choosing command line (a terminal window where you enter commands interpreted by a shell like ‘bash’) together with a texteditor as the programming environment and tools. First, learning a shell like bash is a very useful skill when working with programming and with computers in general. Being confident about using the shell and terminal let’s you learn about the file system, files, the standard streams for output and input, paths, and some environment variables like the PATH variable. The environment for the command line we have chosen (bash or bash via Cygwin) is the standard command line interface for UNIX, GNU/Linux and Mac OS. Being familiar with the bash shell (command interpreter) will prepare you for working with servers and other systems that are running quite a few different operating environments. Also, since we expect all students to run and use bash inside a terminal, all the examples will look the same and we don’t have to provide examples for three (or more) different types of systems.

Q: “So the practice of programming is basically these activities: Edit/save, compile, run?”
A: Yes! However, typically you first analyse what your program should do, what restraints are there and what requirement exist. Then you model the things your programming is managing and lastly you write code to implement how the program will use the things in order to perform the task which the program is there to do. When the actual coding has started, there is typically a cycle of “edit-change, compile, run” which is repeated until you have a functional program. On top of this, it is very common that the programmer also documents the code that is written (so other programmers later can understand how the program and code works) and sometimes even writes a more high-level documentation of the system and even a manual.

The analyses and design are material for a later course and will not be the focus of this course. Writing documentation will be touched upon and that too is something for later courses.

Chapter Links

Our C FAQ

Books this chapter is a part of

Programming with C book

Book TOC | previous chapter | next chapter