implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration]
#define _GNU_SOURCE
#include <unistd.h>
int main() {
usleep(1000);
return 0;
}
Explanation:
#define _GNU_SOURCE
: Defines the _GNU_SOURCE macro before including any header file. This macro is used to enable additional features or extensions specific to the GNU system.#include <unistd.h>
: Includes the header file unistd.h, which provides access to the POSIX operating system API, including the usleep function.int main() {
: Starts the definition of the main function, the entry point of the C program.usleep(1000);
: Calls the usleep function with an argument of 1000 microseconds, causing the program to sleep or delay execution for the specified amount of time.return 0;
: Exits the main function with a return value of 0, indicating successful execution of the program.