It's UWAweek 24 (1st semester, 2nd exam week)


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 1 other person reading this forum.

 UWA week 40 (2nd semester, week 10) ↓
SVG not supported

Login to reply

2:50pm Wed 4th Oct, Christopher M.

Firstly, getopt() is not defined by the C standards (it's not a concern of the language), but is defined by POSIX standards (it's a concern of the portability of the OS interfaces). And because <unistd.h> is not a standard-C header file (, just including it does not provide the function getopt() unless you specify which version of POSIX (or later) you require. This is described in the online manual for getopt() You have two simple choices:
#include <getopt.h>
#define _POSIX_C_SOURCE 2

#include <unistd.h>

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy