0
4

2 回答 2

2

You most likely have a typo or something simple wrong.....try this.

#include <unistd.h>

int
main()
{
    int r;  

    r = unlink("foo");

    return(r);
}

Compile it

gcc -Wall foo.c

Above should be a clean compile. You can pre-process and do a grep to verify that unlink declaration is pulled in.

sys> gcc -E foo.c | grep unlink
int unlink(const char *);
 r = unlink("foo");
于 2013-11-15T18:04:58.570 回答
1

Referring your second issue ("implicit declaration of function sawb"):

Replace

#ifndef __USE_XOPEN
#define __USE_XOPEN 
#endif

with

#define _XOPEN_SOURCE

... placing it before all other #include statements #include <unistd.h> should make the prototyping for swab() be available.


#defines starting with a double underscore __ are reserved for internal use and shall not be set by a program directly.

于 2013-11-15T17:16:51.350 回答