Tuesday, November 12, 2013

XCode, Text Editors, Peanut Butter

I want to wish a big thank you for the guest lecture from software engineer and WWU statistics instructor Brian Morgans who taught a fascinating class on program instruction debugging; all with a loaf of bread, some peanut butter and a knife! I think the students had a great time!  In conclusion, Brian talked about sorting algorithms which are an excellent introduction to developing algorithms in programming.  I recommend the Wikipedia article and links on sorting algorithms. For a fun (but noisy) visualization of sorting algorithms, see here.

We will meet again in the first two weeks of December. I have installed Xcode 3.0 on many of the MACs in the lab and will soon install the entire lab. This allows you to use the gcc and g++ commands from your bash prompt. There will be a graphical interface to XCode 3.0. More on that later. In using the Xcode installation, there may be path issues for libraries you need to address. Read The Fine Manual and e-mail me any questions. The GNU gcc and g++ manuals are here.

Until then, using your apple development account, please attempt to install the appropriate XCode version on your MAC home laptops or workstations. You will need administrative access (Administrator password).  If you have installed Cygwin with development tools on your Windows laptops, you will have access to the gcc and g++ commands.. You should also install a syntax highlighting text editor of your choice. If you have installed Xcode; syntax highlighting will come with that package. TextMate 1.51 for the MAC or Notepad++ for Windows are both free syntax highlighters that are well recommended.

Understanding the installation of compilers and  syntax highlighters will require some patience and *hacking* to make things work.  It is a good habit to read the manuals and "readmes" that come with any compiler or syntax highlighter first before using it. The text for this class is Kerninghan and Ritchie "C Programming;Second Edition" which is freely available as a PDF on the internet. More resources are available here. I recommend simply working your way through K & R "C Programming", pausing to do each exercise in the text.

Remember that the 'info' and 'man' commands contain a wealth of information about all UNIX like operating system commands including gcc and g++.. IFor a quick look at any command options in the bash shell, suffixing that command with '--help' usually produces a brief set of options:

rferrisx@rmfvpc ~
$ info gcc

rferrisx@rmfvpc ~
$ man gcc

rferrisx@rmfvpc ~
$ gcc --help
Usage: gcc [options] file...
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
                           Display specific types of command line options
  (Use '-v --help' to display command line options of sub-processes)


If you need further challenges, I recommend learning the text editor vi or vim. See you soon.

No comments:

Post a Comment