It's UWAweek 9 (1st semester, week 1)

help2002

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 2 other people reading this forum.


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

Login to reply

👍?
helpful
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 (https://en.cppreference.com/w/c/header), 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>
or
#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