CSE 271 Lab 8: C and UNIX IDEs

0. Announcements

1. Overview

This semester we have concentrated on the basics -- using the command line, becoming comfortable with emacs, Makefiles, etc. These are useful things, but they are not always what a modern unix developer uses. So today, we get to explore two integrated development environments with GUIs. Both are free and open source, and both are used extensively by professional developers worldwide in a variety of languages.

2. NetBeans

NetBeans is a cross-platform fully-featured IDE written completely in Java, but supports C/C++, PHP, Java, and more, with plug-in support. The latest NetBeans installation is available on the Suns at: /opt/netbeans-7.2/bin/netbeans. If you haven't used it before, go through some of its tours and sample projects. Then take the code we wrote on Monday for who and create a new project for it in NetBeans. To do so, you'll need to create a directory for the project, put the who.c code there and create a Makefile for it. Then you can tell NetBeans about a new project and its directory.

Instead of using the constant integer 7, find the ut_type entry that 7 corresponds to, and update your code. Make sure it still compiles and runs properly.

Now finish who.c by extracting the time value from the utx entry and converting it into a date. Then extract only the part of the date that you need to replicate the who date format.

3. Eclipse

The second IDE to explore is Eclipse, which is also available for many platforms and languages and written in Java. The latest installation (at /opt/local/bin/eclipse) should already be in your path so you can just type eclipse from the shell to start it.

The first step is to simply import the code from above (choosing "Existing Code as Makefile Project"). Then build and run the code inside of Eclipse. Note that you can view the .h files that are included by double clicking on them in the upper right box.

Now let's create a new project based on the Battleship code you wrote for lab a few weeks ago. Extend your program to ask the human player where to place five ships of varying length (one ship of each type):

You should show the board after each placement, and prevent the user from placing a ship in an impossible place (e.g., diagonal, or hanging off the edge, or on top of an existing ship).

Last revised: 5 March 2013, Prof. Davison.