EDIT: the warning in the first paragraph was due to me reading the old log from the compiler (before including unistd.h, sorry for the missconfusion, the second problem still resides)
I have a code that makes use of the c function unlink (declared in unistd.h). Upon compilation with gcc -Wall I get the warning: implicit declaration of function ‘unlink’
Now I now that this is just a warning but it kinda annoys me and I would like what would be the proper way to resolve this. My current solution is to simply add the line extern int unlink(const char *path);
to the code but this seems a bit silly as I am also including unistd.h
I used to got a warning about the use of the function swab (also declared in unistd.h) but managed, after inspection of unistd.h, to resolve this by adding the lines
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
Not sure that this is the proper thing to do so any insights to this would also be appreciated.