No such file found with semaphore.h and ucontext.h

Cassidy picture Cassidy · Mar 26, 2014 · Viewed 8k times · Source

I have my code here:

#define _GNU_SOURCE

#include "lib-ult.h"

#include <stdio.h>
#include <stdlib.h>

#include <ucontext.h>
#include <semaphore.h>

#define TRUE 1
#define FALSE 0
#define FAILURE -1

typedef struct Node {
    ucontext_t* context;
    int priority;

    struct Node* next;
    struct Node* prev;
} Node;

int STACK_SIZE = 16384;

sem_t queueLock;

sem_t threadsLock;

And when I try to build the project I get Error 1 error C1083: Cannot open include file: 'ucontext.h': No such file or directory (and also for semaphore.h).

Why is this? How do I fix it? Does it have to do with the fact that I have a Windows machine?

Thank you!

Answer

Ferenc Deak picture Ferenc Deak · Mar 26, 2014

ucontext.h and semaphore.h are part of the linux-headers linux package. I don't think you'll be able to compile this application on Windows. Install a virtual machine with Linux and try to compile there.