C++ socket error C1083: Cannot open include file: 'unistd.h': No such file or directory : <p>I'm following this tutorial <strong><a href="https://www.geeksforgeeks.org/socket-programming-cc/" rel="nofollow noreferrer">https://www.geeksforgeeks.org/socket-programming-cc/</a></strong>. I'm trying to practice Socket Programming in C/C++. Can someone tell me why I'm recieving this error and how to fix it? </p>

<p><strong>error C1083: Cannot open include file: 'unistd.h': No such file or directory</strong></p>

<p>thanks in advance</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;string&gt;
#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;string.h&gt;
#define PORT 8080

using namespace std;

int main()
{

    int server_fd, new_socket, valread;
    struct sockaddr_in address;
    int opt = 1;
    int addrlen = sizeof(address);
    char buffer[1024] = { 0 };
    char *hello = "Hello from server";

    // Creating socket file descriptor
    if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0)
    {
        perror("socket failed");
        exit(EXIT_FAILURE);
    }

    // Forcefully attaching socket to the port 8080
    if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,
        &amp;opt, sizeof(opt)))
    {
        perror("setsockopt");
        exit(EXIT_FAILURE);
    }
    address.sin_family = AF_INET;
    address.sin_addr.s_addr = INADDR_ANY;
    address.sin_port = htons(PORT);

    // Forcefully attaching socket to the port 8080
    if (bind(server_fd, (struct sockaddr *)&amp;address,
        sizeof(address))&lt;0)
    {
        perror("bind failed");
        exit(EXIT_FAILURE);
    }
    if (listen(server_fd, 3) &lt; 0)
    {
        perror("listen");
        exit(EXIT_FAILURE);
    }
    if ((new_socket = accept(server_fd, (struct sockaddr *)&amp;address,
        (socklen_t*)&amp;addrlen))&lt;0)
    {
        perror("accept");
        exit(EXIT_FAILURE);
    }
    valread = read(new_socket, buffer, 1024);
    printf("%s\n", buffer);
    send(new_socket, hello, strlen(hello), 0);
    printf("Hello message sent\n");
    return 0;


return 0;
}
</code></pre>
