PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Use of strdup()
Date: Monday, 13 Apr 2020, 21:05:27


    > Message Posted By: Unknown
    >
    > When I go to make my Nine20 file, I am getting warnings for the use of
    > strdup(). I get one overall warning of:
    > "implicit declaration of function `strdup'; did you mean `strcmp'"
    > and then for each call assigning the result of strdup() to a string:
    > "assignment to `char *' from `int' makes pointer from integer without a
    > cast"
    > I #included string.h at the top of my file, so I am unsure as to why there
    > is a problem in using strdup(). Are these errors something that need not
    > be fixed, or is there something I am missing to allow me to use strdup()?

As stated in the specification of Homework #3:

       ...  If you use strdup() or strndup(), you must add the line #define
  _GNU_SOURCE before the first #include.  ...

--Stan-
PREV INDEX NEXT