It's UWAweek 48


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 919 articles.
Currently 7 other people reading this forum.

 UWA week 39 (2nd semester, week 9) ↓
SVG not supported

Login to reply

2:02pm Tue 27th Sep, ANONYMOUS


I'm just finishing off the lab sheet from last week but I am facing a problem when using strdup(). I've defined _POSIX_C_SOURCE as 200809L before the statement that includes the string.h header file as follows:

#define _POSIX_C_SOURCE     200809L
#include <string.h>

However, when I attempt to compile the file I still get this error:

error: implicit declaration of function ‘strdup’; did you mean ‘strcmp’? [-Werror=implicit-function-declaration]

For reference I'm adding "cc -std=c11 -Wall -Werror" to the command line when compiling. When I simply do "gcc -o concordance concordance.c" it works fine.

Could someone please help me with this issue?


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  1:17AM Sep 14 2022
Privacy policy