Programming 3 (Nathan, Semester 1, 2012)

Frequently Asked Questions

This section contains frequently asked questions that came up on the forum, in emails, related courses, etc. Please let the course convenor know if there are any questions you think should go up on the FAQ page!

Can you enrol me in a full lab?

No, I'm afraid that's not possible. Labs only have a certain capacity. If they were over-enrolled, there would not be enough computers for all students. The only choice you have is to swap labs with a fellow student.

You are welcome to attend labs outside the lab you are enrolled in, provided there is a computer available for you (students enrolled in that lab do have preference, of course!). You need to be present in the lab you are enrolled in for marking, though (or make alternate arrangements with your tutor)!

If all labs are full, please see the lecturer!

How can I connect to dwarf or kobold from home?

In order to connect to the ICT servers (like dwarf and kobold) you need to first set up the VLink VPN software. Once you have established a VPN connection with Griffith University, you can then connect to dwarf.cit.griffith.edu.au using an ssh client such as PuTTY.

Can I use the implementation of ... my tutor showed me for my assignment?

Normally, the answer is yes. You can use code shown in the lectures and tutorials for your assignments (with proper reference). However, if the assignment instructs you to use or implement your own (data type(s), class(es), method(s), function(s), or the like), you cannot use this code. You then need to write your own code to implement the functionality for that part of the assignment.

What does 'make: Fatal error: Don't know how to make target `myfile.h mean?

Your text editor ends lines with both a Carriage Return (CR) and a Line Feed (LF). This is the case with many Windows and MS-DOS editors. You can convert a file with CR/LF to just LF using tr on Mac OS X or dwarf:

  tr -d '\r' < Makefile > Makefile.new
  mv Makefile.new Makefile

Will a C++ compiler compile Objective-C?

Probably not. Currently the recommended Objective-C compiler is clang. The standard compilers on MacOS X and Linux are variants of clang and gcc that will most probably work. For Windows you need a fairly recent version of Cygwin or MingW and clang or gcc. On systems other than Mac OS X you will also need to install GNUstep.

Will a C++ compiler such as DevC++ compile plain C?

Yes, almost all C++ compilers will also compile C. Just make sure that your source uses a .c filename extension, not .cpp, .cp (or other extensions reserved for C++).

Why can't I use system("pause"); ?

The pause command is MS-DOS specific. It is available on Windows for backward compatibility, but not on dwarf or other non-Windows systems.

To wait for the user to press the return key, you can use the getchar() function instead. This will work on all systems, including Windows.

Why can't I use gets() ?

The gets() function has a nasty property: it does not check the length of the input read. So no matter how large your input array is, there is always the possibility that there will be input that is longer. This will cause a buffer overflow, causing your program to crash or making it vulnerable to attack!

Instead of gets(), use fgets(), which allows you to specify a buffer size.

What is wrong with char c = getchar(); ?

The getchar() function returns an int, not a char. The reason for this is that getchar() needs to be able to return all possible characters that can be stored in a char, plus an additional, special constant, EOF, that indicates that an error has occurred or that an end of file (EOF) condition has been reached.

What does the following mean?
GNUmakefile:1: /common.make: No such file or directory
GNUmakefile:8: /tool.make: No such file or directory

This happens if you try to use your GNUstep GNUmakefile on the Macs. On Mac OS X, you don't need GNUstep. To resolve this problem, create a normal Makefile in addition to your GNUmakefile and then compile your program using make -f Makefile (you can still use your GNUmakefile to compile your program under GNUstep, e.g. on Linux or Windows).

If this happens on your computer at home, this means that either you do not have GNUStep installed or it is not properly set up in your environment. See the installation instructions for how to add GNUstep.sh to your sta rtup files.

Online Help

Latest Announcements

12/06/2012
Last chance to get feedback before the exam tomorrow.
08/06/2012
Apologies, but please re-check your results — there was an error on the earlier page!
04/06/2012
Just a reminder to check your assignment results online!

Back to top